Bug #1599 | Connection.getCatalog() returns sometimes wrong value. | ||
---|---|---|---|
Submitted: | 19 Oct 2003 11:20 | Modified: | 11 Nov 2009 2:35 |
Reporter: | Teemu Kuulasmaa | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 3.0.9-stable | OS: | Any (all) |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[19 Oct 2003 11:20]
Teemu Kuulasmaa
[19 Oct 2003 13:43]
Mark Matthews
It is best practice in JDBC to set 'session' level settings (catalog, transaction isolation, autocommit, etc) using methods that are exposed in the JDBC API (and in fact it seems to be 'strongly encouraged' in most of the literature that I have read). If you do not, you can end up with un-defined situations such as the one you speak of. Also, it 'insulates' you from changes in the database, (such as the day sometime in the future when MySQL will have support for schemas and catalogs, where 'hardcoded' 'USE ....' statements might have un-intended side-effects). We will look into adding the ability to configure the driver to always read these values from the database, but unfortunately there will _always_ be a performance penalty for doing so.
[19 Oct 2003 22:16]
Teemu Kuulasmaa
It would be good idea to have ability to configure the driver to always read catalog from the server. Admittedly this will decrease performance but sometimes this kind of fuctionality is more important than pure performance. I am looking forward future JDBC driver versions!
[19 Nov 2003 10:35]
Mark Matthews
This is supposed to be clarified in JDBC-4.0. The current consensus (from speaking with many JDBC vendors), is that if you mess with autocommit, transaction isolation levels, or catalogs without going through the proper methods in Connection, you are on your own (the workarounds for reading this data properly when needed begin to get very complex). We're still trying to figure out a way to do this cleanly for Connector/J.