Uploaded image for project: 'MariaDB Connector/J'
  1. MariaDB Connector/J
  2. CONJ-1126

setting fetchSize directly on a ResultSet object does not reflect the expected change

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.3.1
    • Other
    • 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.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            dwenking Wenqian Deng
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.