[Previous slide] [Next slide] Java and Database Connectivity

Putting it all together: tidily

        Connection c = DriverManager.getConnection( url, user, pass);
        Statement s = c.createStatement();
        String q = "select * from ATTENDEE";
        ResultSet r = s.executeQuery( q);

        while ( r.next())
        {
            // do things with the row
        }

        s.close();          // close the statement
        c.close();          // close the connection

 


give me feedback on this page // show previous feedback on this page