If your ultimate goal it to start over with a new schema; an option is to rename/delete the directory within which the db exists.

Raymond Kroeker

On Dec 17, 2007 1:42 AM, < Dyre.Tjeldvoll@sun.com> wrote:
Brad Berens < theg33k@gmail.com> writes:

> I've googled for this but all I can find is create statements so I'm hoping
> someone can just give me a quick answer.  I'm trying to write some db
> creation scripts.  Normally in MSSQL I would use an if exists from the
> system tables to check whether or not to run a drop before creating the
> table.  I found the sys.systables info about derby, but I can't seem to get
> the if clause working for that.
> IF EXISTS (SELECT * FROM sys.systables WHERE tablename='[tablename]') DROP
> TABLE [tablename];

IF EXISTS is a non-std extension AFAICT. You can do this portably by
using DatabaseMetaData.getTables(...). It is a bit more work so you might
want to wrap it in a java method.


Raymond Kroeker