aspose file tools*
The moose likes JDBC and the fly likes get the table name dynamically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "get the table name dynamically" Watch "get the table name dynamically" New topic
Author

get the table name dynamically

joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
hi joe here

is there any method to get the names of the tables present in a database

Thanks in advance
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Have a look at the methods available to you via java.sql.DatabaseMetaData.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

Retrieve meta-data from the database through the established connection like this.



and use methods of this Object to get Database MetaData.


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

The JDBC Meta data answer is the best since its database independent, but you should also be aware many DBMS's keep meta data tables available. For example, in MYSQL there's often an information_schema database schema which contains tables that can be used to read schema/table/column information, as you would normal SQL queries.
[ June 02, 2008: Message edited by: Scott Selikoff ]

My Blog: Down Home Country Coding with Scott Selikoff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: get the table name dynamically