Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
1.2.0
-
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!