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

Wrong Exception thrown for ScrollType TYPE_SCROLL_INSENSITIVE: Invalid operation for result set type TYPE_FORWARD_ONLY

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 1.4.6
    • 1.5.0-RC
    • Failover
    • None
    • Oracle Java 1.8u92
      MariaDB 10
      Connector/J 1.4.6 (reproducible with 1.4.5 too)

    Description

      I wrote a Unit-Test to demonstrate exception

      @Test
          public void scrollScrollableResultTest() throws SQLException {
              insertRows(2);
              PreparedStatement stmt = sharedConnection.prepareStatement("SELECT * FROM result_set_test", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
              stmt.setFetchSize(2);
              ResultSet rs = stmt.executeQuery();
              try {
              	rs.beforeFirst();
              	assertTrue(true);
              } catch(SQLException sqle) {
              	fail("beforeFirst() should work on a TYPE_SCROLL_INSENSITIVE result set");
              } finally {
              	stmt.close();
              	rs.close();
              }
          }
      

      This test will fail.
      Our ERP application failed with the maria driver but worked with the mysql driver and it took us a while figuring out why.

      Reading through the code I found that mariaDb driver ignores the scroll-type, since it's always "SCROLL_INSENSITIVE".
      This is fine, however other parts of the driver do make the distinction.

      a unit-test and "workaround" hack has been written and will create a pull-request for discussion.
      It is a hack, better would be to implement the scroll-type information.

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            leonard@linhome.ch Leonard Lin
            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.