Connecting to the database with the command-line client

The command-line client is a SQL tool that is distributed with the Derby database.

Procedure

The nci_db command-line utility wraps three Derby database utilities:
  • Interactive SQL Client connect: You can use the utility to run SQL statements against the database in real time.
  • The DDL (Data Definition Language) Generation Utility dblook: You can use the utility to generate DDL output from the database.
  • The Derby System information Utility sysinfo: Provides Derby system information.

Examples:

Interactive SQL connect example 1:
$IMPACT_HOME/bin/nci_db connect	
Interactive SQL connect example 2:
$IMPACT_HOME/bin/nci_db connect -sqlfile <Path to the SQL file>
The DDL Generation Utility dblook example:
$IMPACT_HOME/bin/nci_db dblook -d <URL to the Database> [OPTIONS]

The Derby System information Utility sysinfo example:

$IMPACT_HOME/bin/ nci_db sysinfo	

The following command shows the help message for nci_db:

$IMPACT_HOME/bin/nci_db help
Syntax Description
connect
Connects to Derby Interactive SQL Client
-sqlfile <filename>
The SQL source file to be used. If this option is not specified, then you must specify the URL to connect to the database at the prompt.

For example:

ij > connect ’jdbc:derby://localhost:1527/ImpactDB;user=impact;
password=<derby_password>’;
dblook
Runs the DDL generation utility.
-d <url>
The URL to connect to the database.

For example:

"jdbc:derby://localhost:1527/ImpactDB;user=impact;
password=<derby_password>"
[OPTIONS] Options can include:
-z <schemaName>
Specifies a schema to which the DDL generation is limited. Only database objects with that schema have their DDL generated.
-t <tableOne> <tableTwo>
Specifies a list of tables for which the DDL is generated, any tables not in the list are ignored.
-td <value>
Specifies what must be appended to the end of each DDL statement. This defaults to ';'.
-noview
Prevents the generation of DDL for views.
-append
Prevents the overwriting of the output files.
-verbose
Shows error messages that are printed to the console and to the log file. If not specified, errors are printed only to the log file.
-o <filename>
Specifies the file name to which the generated DDL is written. If not specified, default is the console.
sysinfo
Provides Derby System information.