Bug #15071 Incorrect DatabaseMetaData
Submitted: 19 Nov 2005 17:01 Modified: 19 Nov 2005 17:16
Reporter: Adrian Price Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:3.1.11 OS:Linux (RH Linux 9)
Assigned to: CPU Architecture:Any

[19 Nov 2005 17:01] Adrian Price
Description:
Connector/J version 3.1.11 returns the following incorrect DatabaseMetaData values:
storesLowerCaseIdentifiers=true
storesLowerCaseQuotedIdentifiers=true
storesMixedCaseIdentifiers=true
storesMixedCaseQuotedIdentifiers=true
storesUpperCaseIdentifiers=true
storesUpperCaseQuotedIdentifiers=true

They can't all be true! These three pairs of properties are, to my understanding, mutually exclusive. The driver cannot claim both that the database stores identifiers in lower case and also in upper case - that's just plain wrong!

One consequence is that an EJB application which works fine under JBoss-4.0.1 with Connector/J version 3.0.8 fails with version 3.1.11 with an error message to the effect that the table cannot be found. The case of the table name is incorrect: it's lowercase in the error message but uppercase in the database. The reason for this is presumably that JBoss is (quite understandably) confused by the erroneous metadata.

Version 3.0.8 returns the following values:
storesLowerCaseIdentifiers=false
storesLowerCaseQuotedIdentifiers=false
storesMixedCaseIdentifiers=true
storesMixedCaseQuotedIdentifiers=false
storesUpperCaseIdentifiers=false
storesUpperCaseQuotedIdentifiers=false

How to repeat:
There's no simple reproducer for this because (in my case) the J2EE container is using the metadata to determine whether to change identifiers to uppercase, lowercase or leave them unchanged on the basis of the DatabaseMetaData.

The easiest thing is just to look at the source code to see why these settings have changed.

Suggested fix:
Restore the 3.0.8 behaviour - it looks correct to me.
[19 Nov 2005 17:16] Mark Matthews
Duplicate bug, already fixed in source repository. See nightly snapshot builds at http://downloads.mysql.com/snapshots.php#connector-j for the fix until official release of 3.1.12 and 5.0.0