Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help

 
Tom Ben
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tom Ben
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey thanks. I am trying to connect to a Lotus Notes DB and it is not like mySQL.
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tom Ben
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it worked nicly thanks a lot!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic