File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes tjdo tables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

tjdo tables

nitinnitin sharma

Joined: Sep 19, 2003
Posts: 3
hello everybody..
is it possible for me to check whether a particular table exist in a database or not through a program.
Thanks for helping me.
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
Look in tha API at DatabaseMetaData.getTables(). With the parameters set correctly, an null result set will mean the table does not exist. Conversely, a result set with at least one row would mean the table of interest exists.

Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

Yes, in databases like Oracle there are the dba_tables and user_tables view that you can query just like it was a regular table, and the field name table_name is in your where clause.
I am going to move this thread to JDBC. It seems more appropriate there.
Actually it appears that this is a duplicate post. Third time. So instead I am going to close this one, since there is already a duplicate of it in the JDBC forum.
Please refrain from duplicate posting in the future.
Thanks and welcome to JavaRanch.
[ September 19, 2003: Message edited by: Mark Spritzler ]

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: tjdo tables
jQuery in Action, 3rd edition