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

ResultSet not closed on new execution of Statement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 1.1.7
    • 1.1.8
    • None
    • None

    Description

      I noticed with Hibernate I sometimes get java.sql.SQLException: There is an open result set on the current connection, which must be closed prior to executing a query when retrieving a result, depending on the complexity of the entity I am loading. Apparently Hibernate is relying on the specified behavior of the Statement to implicitly close any open ResultSet when performing a new execution.

      From JDBC Spec - 15.2.5 Closing a ResultSet Object

      ...
      A ResultSet object is implicitly closed when

      • The associated Statement object is re-executed
        …

      I worked around this in a local branch with the following code:

      org.mariadb.jdbc.MySQLStatement

      protected boolean execute(Query query) throws SQLException {
          synchronized (protocol) {
              if (protocol.activeResult != null) {
                  protocol.activeResult.close();
              }
              // snip
          }
      }

      Attachments

        Activity

          People

            massimo.siani Massimo Siani (Inactive)
            emattheis Erik Mattheis
            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.