Resultset Corrupted By reusing the Fetchsize API (Doc ID 1216993.1)

Last updated on SEPTEMBER 01, 2014

Applies to:

JDBC - Version 11.1.0.6 and later
Information in this document applies to any platform.

Symptoms

Result set returns incorrect data when the PreparedStatement is reused with reusing Fetchsize API. The issue replicates with 10.2 and 11.1 JDBC driver, and it does not occur with 11.2 version of the JDBC driver. The issue does not occur if the fetch size was not changed.

Example:-
PreparedStatement pstmt = conn.prepareStatement( "select * from testtable where id = ?");

pstmt.setInt(1, 17);
ResultSet rset = pstmt.executeQuery();
rset.setFetchSize(100);
while (rset.next())
System.out.println(rset.getInt(12));
rset.close();
pstmt.clearParameters();

pstmt.setInt(1, 17);
rset = pstmt.executeQuery();
rset.setFetchSize(100);
while (rset.next())
System.out.println(rset.getInt(12));
rset.close();
pstmt.clearParameters();

pstmt.setInt(1, 17);
rset = pstmt.executeQuery();
rset.setFetchSize(100);
while (rset.next())
System.out.println(rset.getInt(12));
rset.close();


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms