Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
3.3.0
-
None
Description
Setting the fetch size directly on a ResultSet object does not reflect the expected change, whereas setting it on the Statement object does.
However, if the fetch size is first set on the Statement and then modified on the ResultSet, the change is successfully reflected, which I think is confusing.
@Test
|
public void test() throws SQLException { |
Connection con = null; |
Statement stmt = null; |
ResultSet rs = null; |
con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test24", "user", "password"); |
stmt = con.createStatement();
|
//stmt.setFetchSize(20); |
rs = stmt.executeQuery("SELECT 1"); |
System.out.println(rs.getFetchSize()); // 0 |
rs.setFetchSize(40); |
System.out.println(rs.getFetchSize()); // 0 |
}
|
In the provided test case, the fetch size is initially attempted to be set directly on a ResultSet object using rs.setFetchSize(40), but querying rs.getFetchSize() afterwards still returns 0, indicating that the fetch size was not updated. In contrast, setting the fetch size on the Statement object using stmt.setFetchSize(20) works as expected. Furthermore, if the fetch size is first set on the Statement and then modified on the ResultSet, the new value is successfully applied.