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

Setting Negative Fetch Size on ResultSet Without Throwing Error

    XMLWordPrintable

Details

    Description

      According to JDBC specifications, setting a fetch size with a negative value on a ResultSet should result in an SQLException.
      However, in the provided test case, when the fetch size is set to -2 on a ResultSet, the connector accepts this value without throwing any exception, which is contrary to the expected behavior.

      @Test
      public void test5() throws SQLException {
          Connection con = null;
          Statement stmt = null;
          ResultSet rs = null;
          con = DriverManager.getConnection("jdbc:mariadb://localhost:3366/test968?user=user&password=password");
          stmt = con.createStatement();
          stmt.execute("CREATE TABLE t0(id INT PRIMARY KEY AUTO_INCREMENT,value FLOAT);");
          stmt = con.createStatement();
          stmt.addBatch("INSERT INTO t0 (value)  VALUES(0.05)");
          stmt.addBatch("DELETE FROM t0 WHERE id <= 2");
          stmt.addBatch("INSERT INTO t0 (value) VALUES(0.03)");
          stmt.executeBatch();
          rs = stmt.getGeneratedKeys();
          rs.setFetchSize(-2); // not throw error
      }
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            dwenking chaos
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.