Bug #9917 Calling getString("TABLE_CAT") returns null catalog
Submitted: 14 Apr 2005 18:02 Modified: 14 Apr 2005 20:35
Reporter: Kate Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:3.1.7 OS:
Assigned to: Mark Matthews CPU Architecture:Any

[14 Apr 2005 18:02] Kate
Description:
This is a change we observed after upgrading to 3.1.7  .  Looking for a workaround?

We use the code: rsTable = DatabaseMetaData.getTables(null, null, null, tabletypes);  to get all the tables in the database.  After that, for each table, we call the API rsTable.getString("TABLE_CAT") to get the catalog name of this table.  

I found if I use mysql-connector-java-3.1.7-bin.jar, it will return an empty string.   If I use mysql-connector-java-3.0.16-ga-bin.jar, I can get the correct catalog name.

Was there a change which caused this?  Is there a different way of doing this we can use which will also work for 3.1.6 and below?

Thanks

How to repeat:
Use the code: rsTable = DatabaseMetaData.getTables(null, null, null, tabletypes);  to get all the tables in the database.  After that, for each table,  call the API rsTable.getString("TABLE_CAT") to get the catalog name of this table.  It will return empty strings.
[14 Apr 2005 20:35] Mark Matthews
Fixed for 3.1.8 

Should accept null for catalog (meaning use current) 
in DBMD methods, even though it's not JDBC-compliant for legacy's sake.

Disable by setting connection property "nullCatalogMeansCurrent" to "false"
 (which will be the default value in C/J 3.2.x).