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 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:
java org.apache.derby.tools.dblook -d jdbc:derby:sample -o myDB_DDL.sql
Specifying a schema in the dblook command
You can
specify the schema for the database. To write the DDL to the console, for
all of the objects in the
sample database where the database
is in the SAMP schema, use the following command:
java org.apache.derby.tools.dblook -d jdbc:derby:sample -z samp
Specifying a schema and a table within the database in the
dblook command
You can specify that only the objects in the
sample database
that are associated with the SAMP and the
My Table table
are written to the console. For example:
java org.apache.derby.tools.dblook -d jdbc:derby:sample -z samp -t "My Table"
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:
java org.apache.derby.tools.dblook -d jdbc:derby:sample -t "My Table" staff