February 10, 2009

How to make a prepared statement scrollable and updateable in JDBC?

// New in JDBC 2.0
PreparedStatement ps2 = conn.prepareStatement(sqlString,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATEABLE);

// New in JDBC 3.0
PreparedStatement ps3 = conn.prepareStatement(sqlString,
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATEABLE,
ResultSet.HOLD_CURSOR_OVER_COMMIT);

3 comments:

Debarshi said...

nice post !!

Debarshi said...

Nice Post!! Is there a way to get specific records by specifying from position and to position.

Matías Rolón said...

Thanks for this post ! It was really helpful.