Bug #1976 ResultSetMetaData getColumnType() getColumnClassName()
Submitted: 28 Nov 2003 1:25 Modified: 28 Nov 2003 7:09
Reporter: Frank Marquardt Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:MySQL 4.1.0-0 / connector 3.1.0-alpha OS:Linux (Linux)
Assigned to: Mark Matthews CPU Architecture:Any

[28 Nov 2003 1:25] Frank Marquardt
Description:
MySQL Server 4.1.0-0 and MySQL Connector/J 3.0.6-stable
getColumnType() and getCollumnClassName() only return java.lang.String for all column types

MySQL Server 4.1.0-0 and MySQL Connector/J 3.1.0-alpha
getColumnType() and getCollumnClassName() only return java.lang.String for all column types

MySQL Server 4.1.0-0 and MySQL Connector/J 3.0.9-stable
getColumnType() and getCollumnClassName() return the right values for the different column types

How to repeat:
Context CTX = new InitialContext();
DataSource DSC = (DataSource)CTX.lookup( sDSC ) );
Connection CON = DSC.getConnection();
Statement STM = CON.createStatement();
ResultSet RES = STM.executeQuery( "SELECT DOUBLE_COL, VARCHAR_COL FROM MY_TABLE" );
ResultSetMetaData RESMD = RES.getMetaData();

System.out.println( "RESMD.getColumnType( 1 ) " + RESMD.getColumnType( 1 ) ); 
System.out.println( "RESMD.getColumnClassName( 1 ) " + RESMD.getColumnClassName( 1 ) ); 
System.out.println( "RESMD.getColumnType( 2 ) " + RESMD.getColumnType( 2 ) ); 
System.out.println( "RESMD.getColumnClassName( 2 ) " + RESMD.getColumnClassName( 2 ) ); 

RES.close();
STM.close();
COM.close();
[28 Nov 2003 7:09] Mark Matthews
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

This is fixed in MySQL-4.1.1 and Connector/J sources after 3.0.8 or 3.1.0 (3.1.1 has not been released yet, you would have to get a nightly build from http://downloads.mysql.com/snapshots.php).