dblook examples

The following examples demonstrate how the various dblook utility
options can be specified from a command line. These examples use the sample database.

Note: The
quotations marks shown in these examples are part of the command argument
and must be passed to dblook. The way in which quotation
marks are passed depends on the operating system and command line that you
are using. With some systems it might be necessary to escape the quotation
marks by using a forward slash before the quotation mark, for example: "\"My
Table"\"

Status messages are written to the output (either
a -o filename, if specified, or the console) as SQL script comments. These
status messages serve as headers to show which types of database objects are
being, or have been, processed by the dblook utility.

Writing the DDL to the console

You can write the
DDL to the console for everything that is in the sample database.
In this example, the database is in the current directory. For example:

java org.apache.derby.tools.dblook -d jdbc:derby:sample

Including error and warning messages in the dblook command

You
can write error and warning messages when you write the DDL to the console.
The messages are written using System.err. For example:

java org.apache.derby.tools.dblook -d jdbc:derby:sample -verbose

Writing the DDL to a file

You can write the DDL
to a file called myDB_DDL.sql for everything that is in the sample database.
In this example, the database and file are in the current directory. For example:

Specifying multiple tables in the dblook command

You
can specify more than one table in the dblook command by separating the names
of the tables with a space. For example, for objects in the sample database
that are associated with either the My Table table or the STAFF table,
use the following command:

Writing DDL to a file without a statement delimiter

To
write the DDL for all of the objects insample database to
the myDB_DDL.sql file without a statement delimiter, you
must omit the default semi-colon. You can append the DDL to the output files
if the files are already there. For example: