Using dblook
Derby Tools and Utilities Guide
59
dblook
Use the
dblook
utility to view all or parts of the Data Definition Language (DDL) for a
given database. To use the
dblook
utility, do one of the following:
· If you are relatively new to the Java programming language, follow the
instructions in "Setting up your environment" in Getting Started with Derby
to set the
DERBY_HOME
and
JAVA_HOME
environment variables and to add
DERBY_HOME/bin
to your path. Then use the following command:
dblook -d connectionURL [options]
· If you are a regular Java user but are new to Derby, set the
DERBY_HOME
environment variable, then use a
java
command to invoke the
derbyrun.jar
file
(all on one line):
(UNIX) java [options] -jar $DERBY_HOME/lib/derbyrun.jar dblook
-d connectionURL [options]
(Windows) java [options] -jar %DERBY_HOME%\lib\derbyrun.jar dblook
-d connectionURL [options]
· If you are familiar with both the Java programming language and Derby, you have
already set
DERBY_HOME
. Set your classpath to include the Derby jar files. Then
use a
java
command to invoke the
dblook
class directly.
java org.apache.derby.tools.dblook -d connectionURL [options]
Using dblook
The syntax for the command to launch the
dblook
utility is:
dblook -d connectionURL [options]
The value for connectionURL is the complete URL for the database. Where appropriate,
the URL includes any connection URL attributes that might be required to access the
database. For complete information on connection URL attributes, see "Setting attributes
for the database connection URL" in the Derby Reference Manual.
For example, to connect to the database 'myDB', the URL would simply be
'jdbc:derby:myDB';
to connect using the Network Server to a database
'C:\private\tmp\myDB' on a remote server (port 1527), the URL would be:
'jdbc:derby://localhost:1527/
"C:\private\tmp\myDB";user=someusr;password=somepwd'
As with other Derby utilities, you must ensure that no other JVMs are started against the
database when you call the
dblook
utility, or an exception will occur and will print to
the
dblook.log
. If this exception is thrown, the
dblook
utility will quit. To recover, you
must ensure that no other Derby applications running in a separate JVM are connected
to the source database. These connections need to be shutdown. Once all existing
JVMs running against the database have been shutdown, the
dblook
utility will execute
successfully. You can also start the Derby Network server and run the
dblook
utility as a
client application while other clients are connected to the server.
dblook options
The
dblook
utility options include:
-z <schemaName>