WDD_lec_16 - 1 Web Design & Development Lec -...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 Web Design & Development Lec - 16 2 Web Design & Development More on JDBC 3 Web Design & Development Result Set JDBC 4 Umair Javed2005 ResultSet Overview A ResultSet contains the results of the SQL query Represented by a table with rows and columns Maintains a cursor pointing to its current row of data. Initially the cursor positioned before the row (0). First row has index 1 JDBC 5 Umair Javed2005 ResultSet (cont.) ResultSet id 1 2 3 Address model town gulberg defence Name ali usman raza phoneNum 9203256 8219065 5173946 1 2 3 Row numbers JDBC 6 Umair Javed2005 ResultSet (cont.) A default ResultSet object is not updateable and has a cursor that moves forward only You can iterate through it only once and only from the first row to last row. String sql = SELECT * FROM Person; PreparedStatement pStmt = con.prepareStatement(sql); ResultSet rs = pStmt.executeQuery( ); JDBC 7 Umair Javed2005 ResultSet (cont.) Useful Methods next( ) Attempts to move to the next row in the ResultSet If successful true is returned; otherwise, false The first call to next, moves the cursor to the first row close( ) Releases the JDBC and database resources The result set is automatically closed when the associated Statement object executes a new query or closed by method call JDBC 8 Umair Javed2005 ResultSet (cont.) Useful Methods getters Returns the value from the column specified by the column name or index String name = rs.getString(name); String add = rs.getString(3); double sal = rs.getDouble(Salary) Returns the value in a specified format double byte int Date String float short long Time Object JDBC 9 Umair Javed2005 ResultSet (cont.) It is possible to produce ResultSet objects that are scrollable and/or updatable (since JDK 1.2)....
View Full Document

Page1 / 29

WDD_lec_16 - 1 Web Design & Development Lec -...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online