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

'getSqlState' vs 'getSQLState' in QueryException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0
    • Fix Version/s: 2.0.0-RC
    • Component/s: Other
    • Labels:
      None

      Description

      report from github (https://github.com/MariaDB/mariadb-connector-j/issues/37) created by bbundy

      Should this actually be spelled 'getSQLState'? It is causing ruby Sequel to fail here:
      https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/jdbc.rb#L396

      If I issue a long-running query via Sequel and set a breakpoint on the line:
      super || (cause.respond_to?(:getSQLState) && cause.getSQLState =~ /^08/)

      and manually kill the query, I get
      Java::OrgMariadbJdbcInternalCommon::QueryException Could not read resultset: unexpected end of stream, read 0bytes from 4

      but cause.respond_to?(:getSQLState) is false!
      (if I monkeypatch this in Sequel to 'cause.respond_to?(:getSqlState)' in the Sequel source, it all works fine)

      this appears to be due to the spelling in
      https://github.com/MariaDB/mariadb-connector-j/blob/master/src/main/java/org/mariadb/jdbc/internal/common/QueryException.java#L135
      (which is 'getSqlState')

      which is correct? I would think for consistency with
      http://docs.oracle.com/javase/7/docs/api/java/sql/SQLException.html
      it should be 'getSQLState'.

      The failure of Sequel to properly identify disconnect errors can cause problems with its threaded connection pool: if the closed connection is mistakenly returned to the pool, the next request that uses it fails unexpectedly.

      Thanks for looking into this!

        Attachments

          Activity

            People

            Assignee:
            diego dupin Diego Dupin
            Reporter:
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration