How to Make Updates to Updatable Result Sets?

Another new feature in the JDBC 2.0 API is the ability to update rows in a result set using methods in the Java programming language rather than having to send an SQL command. But before you can take advantage of this capability, you need to create a ResultSet object that is updatable. In order to do this, you supply the ResultSet constant CONCUR_UPDATABLE to the createStatement method.E.g.Connection con = DriverManager.getConnection("jdbc:mySubprotocol:mySubName");Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);ResultSet uprs = ("SELECT COF_NAME, PRICE FROM COFFEES");

Showing Answers 1 - 2 of 2 Answers

Ashwini

  • Oct 26th, 2005
 

New Features of JDBC2.0

To make a updateble resultset use,

Resultset.CONCUR_UPDATABLE 

  Was this answer useful?  Yes

kalyan789

  • Apr 23rd, 2009
 

Following above answer, we can iterate through result set using, next() method and set corresponding column values for each row, using setInt/String/Float etc methods specifying column index or column name and value.



Thanks
kalyan

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions