Bug #12970 java.sql.Types.OTHER returned for binary and varbinary columns
Submitted: 3 Sep 2005 19:32 Modified: 28 Nov 2005 18:28
Reporter: RW Shore Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.10 OS:Microsoft Windows (WinXP)
Assigned to: Mark Matthews CPU Architecture:Any

[3 Sep 2005 19:32] RW Shore
Create a table with, among other things, some binary and varbinary columns. Execute databaseMetaData.getColumns(null, null, tablename, null). For the binary or varbinary columns, the DATA_TYPE column in the result set contains the integer value java.sql.Types.OTHER rather than the more appropriate Types.BINARY or Types.VARBINARY, respectively. Other column types appear to be reported correctly. The TYPE_NAME column in the result set has the proper string type for the column, but IMO this is a non-standard place to look for the data type of the column.

Java VM: build 1.5.0_04-b05
MySql: 5.0.11-beta-nt

How to repeat:
Result set is repeatable; the getColumns() result set always contains DATA_TYPE of Types.OTHER for binary and varbinary columns.

Suggested fix:
Map the MySql column type into a more appropriate value from java.sql.Types
[28 Nov 2005 18:28] Mark Matthews
Fixed in 3.1.11.