Tuesday, February 6, 2007

What is updatable ResultSet ?

A default ResultSet object is not updatable and has a cursor that moves forward only. It is possible to produce ResultSet objects that are updatable. The following code fragment, in which con is a valid Connection object, illustrates how to make a result set that is scrollable and insensitive to updates by others, and that is updatable. Statement stmt = con.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2"); // rs will be scrollable, will not show changes made by others, // and will be updatable.


SOURCE : www.referjava.com

No comments: