I'm writing a database tools application and a portion of my code depends on whether or not a table exists in the database. Is there any way i can test for this? I have not been able to find any methods in the API.
There are 10 types of people in this world - those who understand binary and those who don't.
posted 15 years ago
Hello, There are numerous methods in the DatabaseMetaData inteface for querying for existing tables, schemas, stored procedures, etc. If the jdbc driver of your database doesn't support it, you can use a direct SQL query on the database metadata (e.g. "select table_name from user_tables" in Oracle) but then you lose portability. Hope this helps.