Bookmark Topic Watch Topic
  • New Topic

tjdo tables

 
nitinnitin sharma
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 263
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
Mark
[ September 19, 2003: Message edited by: Mark Spritzler ]
 
    Bookmark Topic Watch Topic
  • New Topic