This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

get the table name dynamically  RSS feed

 
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: 1325
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
Bartender
Posts: 4093
21
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
Boost this thread!