It's not a secret anymore!
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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: 1864
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?
Consider Paul's rocket mass heater.
subject: Find out if a table exists
jQuery in Action, 3rd edition