Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
1.1.2
-
None
-
None
Description
The getColumnType() method of java.sql.ResultSetMetaData returns an
SQL type code (one of the constants in java.sql.Types). For some MySQL
types, the implementation of this method in the MariaDB Java Client
returns a different code than the implementation in MySQL
Connector/J. For example, for a column declared as "INT UNSIGNED", the
MariaDB Java Client returns BIGINT, but MySQL Connector/J returns
INTEGER.
This gives problems with Hibernate, which uses this metadata to do its
thing.
Here is the list of numerical types for which I found a mismatch:
Declared column type | MariaDB Java Client | MySQL Connector/J |
---|---|---|
FLOAT | FLOAT | REAL |
FLOAT UNSIGNED | FLOAT | REAL |
SMALLINT UNSIGNED | INTEGER | SMALLINT |
INTEGER UNSIGNED | BIGINT | INTEGER |
INT UNSIGNED | BIGINT | INTEGER |
(INT and INTEGER are equivalent of course)
I'm attaching two patches:
- The first one to make the current trunk compile (which it doesn't,
at least not for me, because of a '-' in a method name). - The second fixes the problem, fixes the unit tests and adds one more
unit tests, that combines test the metadata with actual data as
well.
Attachments
Issue Links
- relates to
-
CONJ-96 JDBC types differ between DatabaseMetaData.getColumns and ResultSetMetaData.getColumnType
- Closed