I'm having a hard time trying to enable multi-row fetching from a JDBC connection. When I loop through my ResultSet, the process is very slow and fetches one row at a time (see simple code below)
My driver is db2jcc-4.jar. I'm connecting over a DB2SimpleDataSource and do call
during initialization (not sure if this is necessary)
Any help/suggestion appreciated....
stmt = this.getConnection().createStatement();
ResultSet res = stmt.getResultSet();
logger.debug("Fetch size is "+res.getFetchSize()); // this returns 10000
Kulnor 060000G4Q92 Posts
Re: ResultSet multi row fetch from Java/JDBC?2012-10-24T12:20:00ZThis is the accepted answer. This is the accepted answer.Further to this, I found out for a result set to support multi row in JDBC, a series of conditions must be satisfied
in particular the cursor must be scrollable.
Now to make the cursor scrollable, I need to specify the following resultset type and concurrency.
stmt = this.getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
The issue now is that when I try this, DB2 return
DB2 SQL Error: SQLCODE=-270, SQLSTATE=42997, SQLERRMC=63, DRIVER=4.13.127
which basically seem mean "not supported"