dblook examples

The following examples demonstrate how the various dblook utility options might be specified from a command line. Each example is preceded by a brief description of how the dblook utility behaves given the specified options.

Dump the DDL for everything in database 'sample' (in the current directory) to the console. java org.apache.derby.tools.dblook -d jdbc:derby:sample Dump the DDL for everything in database 'sample' (in the current directory) to the console, and include error/warning messages (with the latter being printed via System.err) java org.apache.derby.tools.dblook -d jdbc:derby:sample -verbose Dump the DDL for everything in database 'sample' (in the current directory) to a file called "myDB_DDL.sql" (in the current directory). java org.apache.derby.tools.dblook -d jdbc:derby:sample -o myDB_DDL.sql Dump the DDL for everything in database 'sample' (in a specified directory) to a file called "newDB.sql" (in a specified directory). java org.apache.derby.tools.dblook -d 'jdbc:derby:c:\private\stuff\sample' -o 'C:\temp\newDB.sql' Dump the DDL for all objects in database 'sample' with schema 'SAMP' to the console. java org.apache.derby.tools.dblook -d jdbc:derby:sample -z samp Dump the DDL for all objects in remote database 'sample' on 'localhost:1527' with schema 'SAMP' to the console. java org.apache.derby.tools.dblook -d 'jdbc:derby://localhost:1527/"C:\temp\sample"; user=someusr;password=somepwd' -z samp Dump the DDL for all objects with schema 'SAMP' in database 'sample' that are related to the table name 'My Table' to the console. java org.apache.derby.tools.dblook -d jdbc:derby:sample -z samp -t "My Table" Dump the DDL for all objects in database 'sample' that are related to either of the table names 'STAFF' or 'My Table' to the console. java org.apache.derby.tools.dblook -d jdbc:derby:sample -t "My Table" staff Dump the DDL for all objects in database 'sample' to myDB_DDL.sql, with no statement delimiter (i.e. leave off the default semi-colon), and append to the output files if they are already there. java org.apache.derby.tools.dblook -d jdbc:derby:sample -o myDB_DDL.sql -td '' -append Dump the DDL for all objects EXCEPT views in database 'sample' to the console. java org.apache.derby.tools.dblook -d jdbc:derby:sample -noview

Status messages are printed 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.