This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes how to access names of different databases Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to access names of different databases" Watch "how to access names of different databases" New topic
Author

how to access names of different databases

amit daundkar
Ranch Hand

Joined: Jan 24, 2009
Posts: 47
hi all,
i use MySQL database. suppose i have created multiple databases with create database command.
i can access name s of the tables in a particular database. but i want to access the names of different databases that i have created.
i dont understand how to do that.

please guide.
thank you.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41599
    
  55
That's what the DatabaseMetaData class is there for. You can obtain an instance of it through Connection.getMetaData(). The getCatalogs and getSchemas methods will provide you with lots of information.


Ping & DNS - my free Android networking tools app
 
jQuery in Action, 2nd edition
 
subject: how to access names of different databases