4 messages in com.mysql.lists.javaRe: MetaData and the Database Name
FromSent OnAttachments
Gary Affonso06 Nov 2004 12:14 
Mark Matthews06 Nov 2004 13:08 
Gary Affonso22 Nov 2004 17:23 
Gary Affonso22 Nov 2004 17:31 
Subject:Re: MetaData and the Database Name
From:Mark Matthews (ma@mysql.com)
Date:11/06/2004 01:08:48 PM
List:com.mysql.lists.java

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

Gary Affonso wrote:

Please forgive, yet another metadata question for the list...

Am I blind, or is there no way to query JDBC MetaData for the name of the database?

I know the db-name is something that's part of the connection string, but in some cases the connection string arrives to my app "fully written" so extracting just the db-name from the connection string means doing some parsing, which I'd prefer to avoid.

Isn't there a metadata method of getting the name of the database to which you're connected?

Thanks!

- Gary

Gary,

Use Connection.getCatalog()

-Mark

- -- Mark Matthews MySQL AB, Software Development Manager - Client Connectivity Office: +1 708 332 0507 www.mysql.com

See you at MySQL ComCon November 8-10! mysqlcomconeurope.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBjT12tvXNTca6JD8RAi/lAJ0fawW3myS2V8tA1djuBE34oBIIdgCgiG++ CGiOjiaiFixOmjCGwsGNGZc= =3HMO -----END PGP SIGNATURE-----