db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikael" <mikael-arons...@telia.com>
Subject Re: checking if table exists
Date Wed, 03 Oct 2007 12:26:51 GMT
You can only use SQL queryes there, no special command line tools, you could 
do something like this in JDBC:

    DatabaseMetaData metadata = null;
    metadata = connection.getMetaData();
    String[] names = { "TABLE"};
    ResultSet tableNames = metadata.getTables( null, null, null, names);

    while( tableNames.next())
    {
          String tab = tableNames.getString( "TABLE_NAME");
    }

tab will contain the table name of each table it finds.....
Not sure if this helps you though....

----- Original Message ----- 
From: "Wolf Bublitz" <wolf.bublitz@uni-dortmund.de>
To: <derby-user@db.apache.org>
Sent: Wednesday, October 03, 2007 2:18 PM
Subject: checking if table exists


> Hi,
>
> I'm new to Derby DB and I want to know how it is possible to check if  a 
> table exits. Via the command line tool I can get a list by typing  "SHOW 
> TALBES" but in Netbeans' db-editor  this does not work.
>
> I get the following error:
>
> SHOW TABLES
>
> Error code 30000, SQL state 42X01: Syntaxfehler: Encountered "SHOW"  at 
> line 1, column 1.
> Line 1, column 1
>
>
> Greetings Wolf 


Mime
View raw message