aspose file tools*
The moose likes JDBC and the fly likes DatabaseMetaData Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DatabaseMetaData" Watch "DatabaseMetaData" New topic
Author

DatabaseMetaData

E Wong
Greenhorn

Joined: Sep 20, 2004
Posts: 6
Hi there, does anyone know of any methods that i could use to count the amount of tables that exist in a database.

What i'm basically trying to do is

if COUNT_OF_TABLES == 0{
conn.close();

Hope someone can shed some light

Best regards,
E Wong
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You can look at the catalogs (see java.sql.DatabaseMetaData methods). But in this instance you miught be better off just using DB specific SQL, e.g.
"show tables;" in MySQL, or querying the sysobject table in MSSQL etc.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Why is it better to use a vendor-specific solution?


http://home.arcor.de/hirnstrom/bewerbung
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DatabaseMetaData