db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Donald McLean" <dmclea...@gmail.com>
Subject Re: checking for the existence of tables, how?
Date Thu, 18 Sep 2008 12:13:23 GMT
On Thu, Sep 18, 2008 at 7:42 AM, Maarten Meijer <mm105@xs4all.nl> wrote:
> I have an application that store data locally in a embedded database.
> it uses ;create=true in the jdbc URL so the db is created if it is not
> already there.
> But next I would like to query it for the existence of some tables.
> How can I do that?
>
> More in general, how can i get meta data such as column names from a Derby
> DB?

In IJ you can use "show tables" to see the system tables (see below).
sys.systables and sys.syscolumns should tell you what you want to
know.

Donald

ij> show tables;
TABLE_SCHEM         |TABLE_NAME                    |REMARKS
------------------------------------------------------------------------
SYS                 |SYSALIASES                    |
SYS                 |SYSCHECKS                     |
SYS                 |SYSCOLPERMS                   |
SYS                 |SYSCOLUMNS                    |
SYS                 |SYSCONGLOMERATES              |
SYS                 |SYSCONSTRAINTS                |
SYS                 |SYSDEPENDS                    |
SYS                 |SYSFILES                      |
SYS                 |SYSFOREIGNKEYS                |
SYS                 |SYSKEYS                       |
SYS                 |SYSROLES                      |
SYS                 |SYSROUTINEPERMS               |
SYS                 |SYSSCHEMAS                    |
SYS                 |SYSSTATEMENTS                 |
SYS                 |SYSSTATISTICS                 |
SYS                 |SYSTABLEPERMS                 |
SYS                 |SYSTABLES                     |
SYS                 |SYSTRIGGERS                   |
SYS                 |SYSVIEWS                      |

Mime
View raw message