wood burning stoves
The moose likes JDBC and Relational Databases and the fly likes tables and fields Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "tables and fields" Watch "tables and fields" New topic

tables and fields

Xinyi Zhang
Ranch Hand

Joined: Apr 28, 2001
Posts: 42
How to list tables in specific database and how to find field name and its data type using Java program? Thanks.

Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
See the javadocs on java.sql.Connection#getMetaData(). Calling myConnection.getMetaData().getTables(null, null, null, null) should return all tables.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link: http://aspose.com/file-tools
subject: tables and fields
It's not a secret anymore!