Saturday 1 September 2012

Explain how to Make Updates to the Updatable ResultSets.


• The JDBC 2.0 API can update rows in a ResultSet using the methods in the Java rather than using a SQL command. 

• But before doing that, we create a ResultSet object which is updatable. 

• For doing this, we give the ResultSet CONCUR_UPDATABLE in the createStatement method.

Code:
Connection con =
DriverManager.getConnection("jdbc:mySubprotocol:mySubName");
Statement stmt =
con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet uprs =
stmt.executeQuery("SELECT COF_NAME, PRICE ");

No comments:

Post a Comment