aspose file tools*
The moose likes JDBC and the fly likes Help 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 "Help" Watch "Help" New topic
Author

Help

Tom Ben
Ranch Hand

Joined: Aug 17, 2001
Posts: 109
How do you return the names of the tables in a given database? I am new to the jdbc and SQL database world come from UniData world.
------------------
Sun Certified Programmer on the Java 2 Platform


Sun Certified Programmer on the Java 2 Platform
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
The key here is the use of the DatabaseMetaData object. That object allows you to find out all sorts of information about a database, including the database name, type, driver, table names, column names, types, etc. A lot of information is available.
The following code (which I haven't yet tested ) should be pretty close to what you need to get your table names and column names.

I hope this helps you out,
Corey


SCJP Tipline, etc.
Tom Ben
Ranch Hand

Joined: Aug 17, 2001
Posts: 109
Hey thanks. I am trying to connect to a Lotus Notes DB and it is not like mySQL.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
As long as the DB is a relational DB, what corey posted should have got you all the tables in the DB. When you said it's not like mySQL, are you saying it's not a relational DB such as Oracle, DB2, MSAccess atc.?
------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Tom Ben
Ranch Hand

Joined: Aug 17, 2001
Posts: 109
I am connecting into the DB blindly and not very familiar with this style of DB I use a Multi-Valued DB.
Thanks Corey I will give this a shot and let you know.
Originally posted by Bosun Bello:
As long as the DB is a relational DB, what corey posted should have got you all the tables in the DB. When you said it's not like mySQL, are you saying it's not a relational DB such as Oracle, DB2, MSAccess atc.?

Tom Ben
Ranch Hand

Joined: Aug 17, 2001
Posts: 109
it worked nicly thanks a lot!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help