December 12, 2006

SQLException: Result set type is TYPE_FORWARD_ONLY

 

Sometimes you encounter this stupid exception:
java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY

How to avoid it ?
Answer:
You need to create the statement of type TYPE_SCROLL_SENSITIVE.
Connection conn = ConnectionPool.getConnection();
Statement stmt = conn.createStatement(
ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);

stmt.setFetchSize...
ResultSet rs = stmt.execute...

0 responses: