aspose file tools
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

Win a copy of The Software Craftsman this week in the Agile forum!
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: 17260

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 - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Have you tried LearnNowOnline?
subject: tjdo tables