Saturday 1 September 2012

How can we move the cursor in a scrollable result set?


• The new features added in the JDBC 2.0 API are able to move a resultset’s cursor backward & forward also.

• There are some methods that let you direct the cursor to a particular row and checking the position of the cursor.

Code :

Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, 

ResultSet.CONCUR_READ_ONLY);

ResultSet srs = stmt.executeQuery(”SELECT COF_NAME, Sale _COFFEE”);

• Three constants can be added to the ResultSet API for indicating the kind 

of the ResultSet object. The constants are:

- TYPE_FORWARD_ONLY

- TYPE_SCROLL_INSENSITIVE

- TYPE_SCROLL_SENSITIVE. 

• The ResultSet constants for specifying whether a resultset is read-only or updatable are:

- CONCUR_READ_ONLY

- CONCUR_UPDATABLE.

No comments:

Post a Comment