# Running dblook

The Derby `dblook` utility is a Data Definition Language (DDL) generation utility.

The `dblook` utility is a simple utility that dumps all or parts of the DDL of a user-specified database to either a console or a file. The generated DDL can then be used for such things as recreating all or parts of a database, viewing a subset of the objects in a database (for example, those objects that pertain to specific tables and schemas), or documenting the schema of a database.

Choose the method that you will use to run the `dblook` script. The methods are listed in the following table.

Table 1. Methods of running the `dblook` utility
Method | When to Use | Command
--- | --- | ---
Run `dblook` as a standalone command. | Use this method if you are relatively new to the Java programming language and new to Derby. | Follow the steps in Setting the environment variables before you run the `dblook` utility using this method. To run the `dblook` script from the command line use:
    dblook -d connectionURL [options]
The `dblook` script sets the appropriate environment variables, including the CLASSPATH, and runs the `dblook` utility.
Run `dblook` using the jar file that is located in the directory where `dblook` resides. | Use this method if you are new to Derby, but are familiar with the Java programming language. | You must set the DERBY_HOME environment variable before you can run the `dblook` utility using this method. On UNIX, the command is:
    java [options] -jar $DERBY_HOME/lib/derbyrun.jar dblook -d connectionURL [options]
On Windows, the command is:
    java [options] -jar %DERBY_HOME%\lib\derbyrun.jar dblook -d connectionURL [options]
Run `dblook` using the `java` command. | Use this method if you are familiar with both the Java programming language and Derby, and you have already added the location of the `java` executable file to your command execution PATH. | You must set your CLASSPATH. Use the steps specified in Manually setting the CLASSPATH/MODULEPATH environment variables. Then specify the class name in the `java` command. For example:
    java org.apache.derby.tools.dblook -d connectionURL [options]
Run `dblook` using the `java` command using a modulepath. | Use this method if you are familiar with both the Java programming language and Derby, have already added the location of the `java` executable file to your command execution PATH, and expect to run Derby with a modulepath. | You must set your MODULEPATH. Use the steps specified in Manually setting the CLASSPATH/MODULEPATH environment variables. Then specify the tools module and the dblook class name in the `java` command. On UNIX, the command is:
    java -p $MODULEPATH \
      -m org.apache.derby.tools/org.apache.derby.tools.dblook \
      -d connectionURL [options]
On Windows, the command is:
    java -p %MODULEPATH% ^
      -m org.apache.derby.tools/org.apache.derby.tools.dblook ^
      -d connectionURL [options]

See Using the Derby tools and startup utilities for an example of the use of the connectionURL. See "dblook" and its subtopics in the Derby Tools and Utilities Guide for more information about using the `dblook` utility.
Parent topic: Using the Derby tools and startup utilities