• 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 ");
• 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