Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

get the table name dynamically

 
joseph prabhu
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi joe here

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

Thanks in advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the methods available to you via java.sql.DatabaseMetaData.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Retrieve meta-data from the database through the established connection like this.



and use methods of this Object to get Database MetaData.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic