-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Andy Jefferson wrote: > Hi, > > has anyone found a good way of determining the schema name using a JDBC > connection to MySQL ? > > I've tried accessing DatabaseMetaData and calling getSchemas() to get the > schemas and it returns nothing using 3.0.8 of the connector. > > I've also tried tried DatabaseMetaData.getTables() and grab the second > String and it just returns null. > > Any ideas? > > TIA
MySQL doesn't have schemas (currently). They are being developed in a future version. The DatabaseMetaData interface in JDBC has a method, 'getSchemaTerm' which tells you whether a certain database supports schemas or not (returning "" when schemas are not supported). MySQL supports _catalogs_, so you would use the DatabaseMetaData method 'getCatalogs' to see all catalogs (databases in 'mysql' vernacular) in your database, or the 'getCatalog' method in the Connection interface to retreive the catalog the connection is currently using. Regards, -Mark - -- Mr. Mark Matthews MySQL AB, Software Development Manager, J2EE and Windows Platforms Office: +1 708 557 2388 www.mysql.com Are you MySQL Certified? http://www.mysql.com/certification/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQE/d39wtvXNTca6JD8RAuGXAJ99TTSizlQm1PDjxrUUda6ePPLXCQCfUIYC iPqwbAme5s4WZUkSGcO8gIo= =LQsi -----END PGP SIGNATURE----- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]