Scrolling ResultSet JDBC Postgresql

When I create a prepared statement like this in java (using JDBC):

pStmt = conn.prepareStatement(qry); 

everything is working fine. However, when I want a scrollable result set and use this:

 pStmt = conn.prepareStatement(qry,ResultSet.TYPE_SCROLL_INSENSITIVE); 

I get a syntax error:

 org.postgresql.util.PSQLException: ERROR: syntax error at or near "RETURNING" 

I do not even use RETURNING in my request.

Any ideas?

Any help would be greatly appreciated. Thanks

Update: It seems to work if I use this:

 pStmt = db.prepareStatement(qry,ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); 

What is the difference between SENSITIVE and INSENSITIVE?

thanks

+4
source share
1 answer

The second parameter for prepareStatement must be one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYS.

I think you want to use

 PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) 
+4
source

All Articles