File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Find out if a table exists Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Find out if a table exists" Watch "Find out if a table exists" New topic

Find out if a table exists

Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1868
How can i find out whether a table exists. If a tabel exists then i want to add a record to it. If it does not i want to create a new table and then add a record to it.
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
You can use the methods available in the DatabaseMetaData class.
It's in the java.sql package.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
Apu Nahasapeemapetilon
Ranch Hand

Joined: Sep 06, 2000
Posts: 51
is this a java question or a DB (database) question?
I agree. Here's the link:
subject: Find out if a table exists
It's not a secret anymore!