← Back to team overview

maria-discuss team mailing list archive

New Question: ResultSetMetaData getColumnClassName accuracy for JDBC

 

Hello,

A new question has been asked in "Client Libraries" by tommy_pham_g. Please answer it at http://mariadb.com/kb/en/resultsetmetadata-getcolumnclassname-accuracy-for-jdbc/ as the person asking the question may not be subscribed to the mailing list.

--------------------------------
Hi folks,

I'm having problems getting the getColumnClassName to return the correct information.  I have a sample table:

CREATE TABLE `datatypes` (
  `mariadb_binary` binary(8) NULL,
  `mariadb_blob` blob NULL,
  `mariadb_boolean` tinyint(1) NULL,
  `mariadb_varbinary` varbinary(16) NULL,
  `mariadb_varchar` varchar(5) CHARACTER SET utf8 NULL,
  UNIQUE KEY `mariadb_serial` (`mariadb_serial`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

The ResultSetMetaData is not returning accurate GetColumnClassName information for some of the above columns:

[INFO ] 2015-03-02 09:26:52.905 [main] c.d.d.AppDbTest.main - getColumnName mariadb_binary | getColumnLabel mariadb_binary.
getColumnClassName [B.
getColumnDisplaySize 8.
getColumnType -2.
getColumnTypeName BINARY.

[INFO ] 2015-03-02 09:26:52.905 [main] c.d.d.AppDbTest.main - getColumnName mariadb_blob | getColumnLabel mariadb_blob.
getColumnClassName [B.
getColumnDisplaySize 65535.
getColumnType -4.
getColumnTypeName BLOB.

[INFO ] 2015-03-02 09:26:52.905 [main] c.d.d.AppDbTest.main - getColumnName mariadb_boolean | getColumnLabel mariadb_boolean.
getColumnClassName java.lang.Boolean.
getColumnDisplaySize 1.
getColumnType -7.
getColumnTypeName TINYINT.
getPrecision 1.

[INFO ] 2015-03-02 09:26:52.998 [main] c.d.d.AppDbTest.main - getColumnName mariadb_varbinary | getColumnLabel mariadb_varbinary.
getColumnClassName [B.
getColumnDisplaySize 16.
getColumnType -3.
getColumnTypeName VARBINARY.
getPrecision 16.

[INFO ] 2015-03-02 09:26:53.014 [main] c.d.d.AppDbTest.main - getColumnName mariadb_varchar | getColumnLabel mariadb_varchar.
getColumnClassName java.lang.String.
getColumnDisplaySize 5.
getColumnType 12.
getColumnTypeName VARCHAR.
getPrecision 5.


Is the above by design?  Is it bug within JDBC spec?  I'm using MariaDB JDBC version 1.1.8.

Thanks,
Tommy
--------------------------------

To view or answer this question please visit: http://mariadb.com/kb/en/resultsetmetadata-getcolumnclassname-accuracy-for-jdbc/