• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help

 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey thanks. I am trying to connect to a Lotus Notes DB and it is not like mySQL.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it worked nicly thanks a lot!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic