http://www.apache.org/licenses/LICENSE-2.0
•
|
ij
| |
•
|
the import and export utilities
| |
•
|
the database class loading utilities
| |
•
|
sysinfo
| |
•
|
dblook
|
•
|
developers, who might use the tools when developing applications
| |
•
|
system administrators, who might use the tools to run backup scripts or
to import large amounts of data
| |
•
|
end-users, who might use one of the tools to run ad-hoc queries against
a database
|
•
|
What are the Derby tools and utilities?
Overview of the tools and
utilities, and Derby and JDBC basics for new or infrequent users.
| |
•
|
Using ij
How to get started with ij,
a JDBC and SQL scripting tool.
| |
•
|
ij properties reference
Reference for ij properties.
| |
•
|
ij commands and errors reference
Reference for ij commands
and errors.
| |
•
|
Using the bulk import and export procedures
Reference and how-to instructions
for using bulk import and export.
| |
•
|
sysinfo
Reference information
on the utility that provides information about your Derby environment.
| |
•
|
dblook
dblook is Derby's Data Definition
Language (DDL) Generation Utility, which is more informally called a schema
dump tool. It is a simple utility that dumps the DDL of a user-specified database
to either a console or to a file. The generated DDL can then be used to recreate
all or parts of a database, view a subset of a database's objects (for example,
those which pertain to specific tables or schemas), or document a database's
schema.
|
•
|
ij
ij is Derby's
interactive JDBC scripting tool. It is a simple utility for running scripts
against a Derby database.
You can also use it interactively to run ad hoc queries. ij provides
several commands for ease in accessing a variety of JDBC features.
ij can
be used in an embedded or a client/server environment.
| |
•
|
The import and export utilities
These server-side utilities
allow you to import data directly from files into tables and to export data
from tables into files. (You can use the utilities in a client/server environment.)
| |
•
|
Database class utilities
These utilities allow you to store
application logic in a database and to boot an application using the stored
classes.
| |
•
|
sysinfo
sysinfo provides information about your version of Derby and your environment.
| |
•
|
dblook
dblook is Derby's
Data Definition Language (DDL) Generation Utility, also called a schema dump
tool. It is a simple utility for the dumping the DDL of a user-specified database
to either a console or to a file. The generated DDL can then be used for such
things as recreating all or parts of a database, viewing a subset of a database's
objects (for example, those which pertain to specific tables and schemas),
or documenting a database's schema.
|
•
|
To use ij, you must have derbytools.jar in your classpath. If you are using the embedded driver, you must also
include derby.jar.
| |
•
|
To use the import and export utilities and the database class utilities,
you must have derby.jar in your classpath.
| |
•
|
To use sysinfo, either derby.jar or derbytools.jar must be in your classpath.
| |
•
|
To use Derby tools from a client with the Derby Network Server,
you must have derbyclient.jar and derbytools.jar in your classpath. See the
Derby Server and Administration Guide
for more information.
|
•
|
org.apache.derby.jdbc.EmbeddedDriver
For embedded
environments, when Derby runs in the same JVM as the application
| |
•
|
org.apache.derby.jdbc.ClientDriver
For using the Network Client to connect to the Derby Network Server
|
•
|
jdbc:derby:databaseName;URLAttributes
|
•
|
jdbc:derby://host:port/databaseName
|
•
|
jdbc:derby://host:port/"databaseName;URLAttributes";
|
•
| ||
•
| ||
•
|
host
The name of the machine where the server is running.
It can be the name of the machine or the address.
| |
•
|
•
| ||
•
|
Database territory
This is the territory associated
with your database when it is created. By default, this is the same as the
java system locale
. The database territory determines
the language of database errors.
| |
•
|
ij> VALUES CURRENT_DATE; 1 ---------- 2001-08-06 1 row selected ij> localizeddisplay on; ij> VALUES CURRENT_DATE; 1 ------------------ September 6, 2001 1 row selected
The command line items are:
•
|
java
The JVM you want to run (java is the name
of the JVM program).
| |
•
|
options
The options that the JVM uses. You can
use the -D command to set ij properties (see
Starting ij using properties
)
or system properties, such as Derby properties.
| |
•
|
propertyFile
A file you can use to set ij properties
(instead of the -D command). The property file should be in the format created
by the java.tools.Properties.save methods, which is the same format as the
derby.properties file.
| |
•
|
inputFile
A file from which to read commands.
The ij tool exits at the end of the file or an exit command. Using an input
file causes ij to print out the commands as it runs them. If you reroute standard
input, ij does not print out the commands. If you do not supply an input file,
ij reads from the standard input.
|
1.
|
by using the -D command on the command line
| |
2.
|
by specifying a properties file using the -p propertyfile option
on the command line
|
java org.apache.derby.tools.ij -p ij.properties
java -Dij.maximumDisplayWidth=1000 org.apache.derby.tools.ij
java -Dij.protocol=jdbc:derby: -Dij.database=sample org.apache.derby.tools.ij
To see a list of connection names and the URL's used to connect to them, use the following command: (If there is a connection that is currently active, it will show up with an * after its name.)java -Dij.connection.sample=jdbc:derby:sample -Dij.connection.History=jdbc:derby:History -Dderby.system.home=c:\derby\demo\databases org.apache.derby.tools.ij
ij version 10.1 ij(HISTORY)> show connections; HISTORY* - jdbc:derby:History SAMPLE - jdbc:derby:sample * = current connection ij(HISTORY)>
1.
|
Load the appropriate driver.
| |
2.
|
Provide a database connection URL for the database.
|
•
|
Full database connection URL
ij can work with any JDBC driver. For
drivers supplied by other vendors, you need to load the driver separately.
For drivers supplied by Derby,
you can load the driver by specifying the full database connection URL in
the connection. You do not need to load the driver explicitly in a second
step.
To connect, specify the full database connection URL in a
Connect
command,
ij.connection.connectionName
property, or
ij.database
property.
The
protocol of the database connection URL must correspond to the driver provided
by Derby (see
Database connection URLs
)
or, if you are using another driver, to that driver. The following example
shows how to connect to a Derby database
by using the Connect command:
| |
•
|
Protocol and short database connection URL
For drivers supplied by Derby, specifying a protocol
automatically loads the appropriate driver. You do not need to load the driver
explicitly in a separate step. You specify a protocol with a property (
ij.protocol
or
ij.protocol.protocolName
)
or command (
Protocol
).
To
connect, specify the "short form" of the database connection URL in a
Connect
command,
ij.connection.connectionName
property, or
ij.database
property. A
short form of the database connection URL eliminates the protocol (For more
information, see
About Protocols
).
| |
•
|
Driver and full database connection URL
If you are using the drivers
supplied by Derby, use
the driver names listed in
JDBC drivers overview
.
The Derby drivers are
implicitly loaded when a supported protocol is used. Any other driver has
to be explicitly loaded. You can load a driver explicitly with an ij property
(
ij.Driver
), a system
property (jdbc.drivers), or a command (
Driver
).
To
connect, specify the full database connection URL in a
Connect
command,
ij.connection.connectionName
property, or
ij.database
property.
|
Action
|
System Property
|
ij Property
|
ij Command
|
loading the driver implicitly
|
'
|
ij.connection.connectionName
(plus
full URL)
ij.database
(plus
full URL)
ij.protocol
ij.protocol.protocolName
(plus protocol
clause in Connect command)
|
|
loading the driver explicitly
|
jdbc.drivers
|
-D
ij.Driver
|
|
specifying the database connection URL
|
'
|
•
|
Name an input file as a command-line argument.
For
example:
| |
•
|
Redirect standard input to come from a file.
For
example:
| |
•
|
Use the
Run
command
from the ij command line.
For example:
|
•
|
By redirecting output to a file:
| |
•
|
By setting the
ij.outfile
property
(See
ij.outfile
):
|
ij.connection. connectionName = databaseConnectionURL
ij.database= databaseConnectionURL
java -Dij.protocol=jdbc:derby: -Dij.connection.sample1=sample -Dij.connection.anotherConn=anotherDB -Dij.database=wombat;create=true org.apache.derby.tools.ij ij version 10.1 CONNECTION2* - jdbc:derby:wombat;create=true ANOTHERCONN - jdbc:derby:anotherDB SAMPLE1 - jdbc:derby:sample * = current connection ij(CONNECTION2)>
•
|
jdbc:derby:
|
ij> Connect 'jdbc:derby:anyDB;create=true;unicode=falj'; ERROR XJ05B: JDBC attribute 'unicode' has an invalid value 'falj', valid values are '{true|false}'. ij>
java org.apache.derby.tools.ij ij version 10.1 ij> connect 'mydb;uSer=naomi'; URL Attribute [uSer=naomi] Case of the Derby attribute is incorrect.
java -Dij.URLCheck=false org.apache.derby.tools.ij ij version 10.1 ij> connect 'mydb;uSer=naomi'; ij>
•
|
bootPassword
| |
•
|
create
| |
•
|
databaseName
| |
•
|
dataEncryption
| |
•
|
encryptionAlgorithm
| |
•
|
encryptionProvider
| |
•
|
territory
| |
•
|
logDevice
| |
•
|
password
| |
•
|
shutdown
| |
•
|
unicode
| |
•
|
upgrade
| |
•
|
user
|
derby.ui.codeset= derbyval
java -Dderby.ui.territory=ja_JP -Dderby.ui.codeset=Cp939 -Dij.protocol=jdbc:derby: org.apache.derby.tools.ij
Character Encoding
|
Explanation
|
8859_1
|
ISO Latin-1
|
8859_2
|
ISO Latin-2
|
8859_7
|
ISO Latin/Greek
|
Cp1257
|
Windows Baltic
|
Cp1258
|
Windows Vietnamese
|
Cp437
|
PC Original
|
EUCJIS
|
Japanese EUC
|
GB2312
|
GB2312-80 Simplified Chinese
|
JIS
|
JIS
|
KSC5601
|
KSC5601 Korean
|
MacCroatian
|
Macintosh Croatian
|
MacCyrillic
|
Macintosh Cyrillic
|
SJIS
|
PC and Windows Japanese
|
UTF8
|
Standard UTF-8
|
C:\> REM This example is from a DOS prompt: C:\> java -Dij.protocol=jdbc:derby: org.apache.derby.tools.ij ij version 10.1 ij> connect 'menuDB;create=true'; ij> CREATE TABLE menu(course CHAR(10), item CHAR(20), price INTEGER); 0 rows inserted/updated/deleted ij> disconnect; ij> exit; C:\>
ij> INSERT INTO menu VALUES ('appetizer','baby greens',7), ('entree','lamb chops ',6),('dessert','creme brulee',14); 3 rows inserted/updated/deleted ij> SELECT * FROM menu; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 dessert |creme brulee |6 appetizer |baby greens |7 3 rows selected ij>
ij> autocommit off; ij> DROP TABLE menu; 0 rows inserted/updated/deleted ij> CREATE TABLE menu (course CHAR(10), item CHAR(20), price INT); 0 rows inserted/updated/deleted ij> INSERT INTO menu VALUES ('entree', 'lamb chop', 14), ('dessert', 'creme brulee', 6), ('appetizer', 'baby greens', 7); 3 rows inserted/updated/deleted ij> commit; ij> autocommit on; ij>
ij> get cursor menuCursor as 'SELECT * FROM menu'; ij> next menuCursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> next menuCursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> close menuCursor; ij>
ij> connect 'jdbc:derby:menuDB;create=true'; ij> -- we create a new table in menuDB: CREATE TABLE menu(course CHAR(10), item CHAR(20), price INTEGER); ij> protocol 'jdbc:derby:'; ij> connect 'sample' as sample1; ij(SAMPLE1)> connect 'newDB;create=true' as newDB; ij(NEWDB)> show connections; CONNECTION0 - jdbc:derby:menuDB NEWDB* - jdbc:derby:anotherDB SAMPLE1 - jdbc:derby:newDB ij> ij> connect 'jdbc:derby:sample' user 'sa' password 'cloud3x9'; ij>
ij> connect 'jdbc:derby:menuDB;create=true'; ij> -- we create a new table in menuDB: CREATE TABLE menu(course CHAR(10), ITEM char(20), PRICE integer); 0 rows inserted/updated/deleted ij> disconnect; ij> protocol 'jdbc:derby:'; ij> connect 'sample' as sample1; ij> connect 'newDB;create=true' as newDB; SAMPLE1 - jdbc:derby:sample NEWDB* - jdbc:derby:newDB;create=true * = current connection ij(NEWDB)> set connection sample1; ij> disconnect sample1; ij> disconnect all; ij>
•
| ||
•
| ||
•
|
To execute either flavor of command when that command contains dynamic
parameters, taking values from the Using portion of the command. In this style,
the Using portion's String or previously prepared Identifier is executed, and it must have a result set
as its result. Each row of the result set is applied to the input parameters
of the command to be executed, so the number of columns in the Using's
result set must match the number of input parameters in the
Execute
's statement. The results of each execution of the
Execute
statement are displayed as they are made. If the Using's
result set contains no rows, the
Execute
's
statement is not executed.
When auto-commit mode is on, the Using's
result set is closed upon the first execution of the
Execute
statement. To ensure multiple-row execution of the
Execute
command, use the
Autocommit
command
to turn auto-commit off.
|
GET [WITH {HOLD|NOHOLD}] CURSOR Identifier AS String
ij> -- autocommit needs to be off so that the positioned update ij> -- can see the cursor it operates against. ij> autocommit off; ij> get cursor menuCursor as 'SELECT * FROM menu FOR UPDATE OF price'; ij> next menuCursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> next menuCursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> UPDATE menu SET price=price+1 WHERE CURRENT OF menuCursor; 1 row inserted/updated/deleted ij> next menuCursor; COURSE |ITEM |PRICE ----------------------------------------------- appetizer |baby greens salad |7 ij> close menuCursor; ij> commit; ij>
GET SCROLL INSENSITIVE [WITH {HOLD|NOHOLD}] CURSOR Identifier AS String
•
| ||
•
| ||
•
| ||
•
| ||
•
| ||
•
| ||
•
| ||
•
| ||
•
|
ij> autocommit off; ij> get scroll insensitive cursor scrollCursor as 'SELECT * FROM menu FOR UPDATE OF price'; ij> absolute 5 scrollCursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> after last scrollcursor; No current row ij> before first scrollcursor; No current row ij> first scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> last scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> previous scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> relative 1 scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij>>previous scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> next scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6
ij> get scroll insensitive cursor scrollCursor as 'SELECT * FROM menu FOR UPDATE OF price'; ij> absolute 5 scrollCursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> last scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6
ij> get scroll insensitive cursor scrollCursor as 'SELECT * FROM menu FOR UPDATE OF price'; ij> last scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> previous scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14
ij> connect 'jdbc:derby:menuDB'; ij> readonly on; ij> SELECT * FROM menu; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 dessert |creme brulee |6 appetizer |baby greens |7 entree |lamb chop |14 entree |lamb chop |14 dessert |creme brulee |6 6 rows selected ij> UPDATE menu set price = 3; ERROR 25502: An SQL data change is not permitted for a read-only connection, user or database.
ij> -- autocommit needs to be off so that the positioned update ij> -- can see the cursor it operates against. ij> autocommit off; ij> get scroll insensitive cursor scrollCursor as 'SELECT * FROM menu FOR UPDATE OF price'; ij> last scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6 ij> previous scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 ij> relative 1 scrollcursor; COURSE |ITEM |PRICE ----------------------------------------------- dessert |creme brulee |6
ij> prepare seeMenu as 'SELECT * FROM menu'; ij> execute seeMenu; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 dessert |creme brulee |6 2 rows selected ij> remove seeMenu; ij> execute seeMenu; IJ ERROR: Unable to establish prepared statement SEEMENU ij>
ij> autocommit off; ij> INSERT INTO menu VALUES ('dessert', 'rhubarb pie', 4); 1 row inserted/updated/deleted ij> SELECT * from menu; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 dessert |creme brulee |7 appetizer |baby greens |7 dessert |rhubarb pie |4 4 rows selected ij> rollback; ij> SELECT * FROM menu; COURSE |ITEM |PRICE ----------------------------------------------- entree |lamb chop |14 dessert |creme brulee |7 appetizer |baby greens |7 3 rows selected ij>
ij> run 'setupMenuConn.ij'; ij> -- this is setupMenuConn.ij -- ij displays its contents as it processes file ij> connect 'jdbc:derby:menuDB'; ij> autocommit off; ij> -- this is the end of setupMenuConn.ij -- there is now a connection to menuDB and no autocommit. -- input will now resume from the previous source. ; ij>
•
|
Use export procedures to write data from a database to one or more files
that are stored outside of the database. You can use a procedure to export
data from a table into a file or export data from a SELECT statement result
into a file.
| |
•
|
Use import procedures to import data from a file into a table. If the
target table already contains data, you can replace or append to the existing
data.
|
1.
|
To import data from a file to a table, use the SYSCS_UTIL.SYSCS_IMPORT_TABLE
procedure. The procedure definition is:
No Result is returned from the procedure. | |
2.
|
To import data from a file to a subset of columns in a table, use the
SYSCS_UTIL.SYSCS_IMPORT_DATA procedure. To import data to subset of columns
in a table, you specify insertColumns on the table
into which data will be imported and/or specify columnIndexes to import data fields from a file to columns in a table. The procedure
definition is:
No result is returned from the procedure. |
1.
|
To export all the data from a table to a file, use the SYSCS_UTIL.SYSCS_EXPORT_TABLE
procedure. The procedure definition is:
No Result is returned from the procedure. | |
2.
|
To export the result of a SELECT statement to a file, use the SYSCS_UTIL.SYSCS_EXPORT_QUERY
procedure. The procedure definition is:
No result is returned from the procedure. |
CALL SYSCS_UTIL.SYSCS_EXPORT_QUERY ('select * from staff where dept=20', 'c:\output\awards.del',null,null,null);
CREATE TABLE tab1 (c1 CHAR(30), c2 INT GENERATED ALWAYS AS IDENTITY, c3 REAL, c4 CHAR(1))
•
|
Suppose you want to import data into tab1 from a file myfile.del that
does not have identity column information and myfile.del contains
three fields with the following data:
To import data from myfile.del into the tab1 table, explicitly list the column names for tab1 without the identity column c2 and execute the SYSCS_UTIL.SYSCS_IMPORT_DATA procedure as follows:
| |
•
|
Suppose you want import data into tab1 from a file empfile.del that
also has identity column information and the file contains three fields with
the following data:
To import data from empfile.del into the tab1 table, explicitly specify an insert column list without the identity column c2 and specify the column indexes without identity column data and execute the SYSCS_UTIL.SYSCS_IMPORT_DATA procedure as follows:
|
PreparedStatement ps=conn.prepareStatement("CALL SYSCS_UTIL.SYSCS_EXPORT_TABLE (?,?,?,?,?,?)"); ps.setString(1,null); ps.setString(2,"staff"); ps.setString(3,"staff.dat"); ps.setString(4,"%"); ps.setString(5,null); ps.setString(6,null); ps.execute();
•
|
Rows are separated by a new line.
| |
•
|
Fields are separated by a comma (,)
| |
•
|
Character-based fields are delimited with double quotes (")
|
•
|
Delimiters are mutually exclusive
| |
•
|
A delimiter cannot be a line-feed character, a carriage return, or a blank
space.
| |
•
|
The default decimal point (.) cannot be a character delimiter.
|
The preceding character string gets imported into the database as:"what a ""great"" day!"
What a "great" day!
The preceding character string gets exported to a file as:"The boot has a 3" heel."
"The boot has a 3""heel."
1,abc,22,def 22,,,"a is a zero-length string, b is null" 13,"hello",454,"world" 4,b and c are both null,,
1,"abc",22,"def" 22,,,"a is a zero-length string, b is null" 13,"hello",454,"world" 4,"b and c are both null",,
7,95,,Happy Birthday
Character Encoding
|
Explanation
|
8859_1
|
ISO Latin-1
|
8859_2
|
ISO Latin-2
|
8859_7
|
ISO Latin/Greek
|
Cp1257
|
Windows Baltic
|
Cp1258
|
Windows Vietnamese
|
Cp437
|
PC Original
|
EUCJIS
|
Japanese EUC
|
GB2312
|
GB2312-80 Simplified Chinese
|
JIS
|
JIS
|
KSC5601
|
KSC5601 Korean
|
MacCroatian
|
Macintosh Croatian
|
MacCyrillic
|
Macintosh Cyrillic
|
SJIS
|
PC and Windows Japanese
|
UTF-8
|
Standard UTF-8
|
CALL SQLJ.replace_jar(' jarFilePath ', qualifiedJarName, 0)
•
|
jarFilePath
The path
and physical name of the jar file to add or use as a replacement. For example:
d:/todays_build/tours.jar
| |
•
|
qualifiedJarName
The Derby name of the jar file,
qualified by the schema name. Two examples:
|
$ java org.apache.derby.tools.sysinfo ------------------ Java Information ------------------ Java Version: 1.4.2_07 Java Vendor: Sun Microsystems Inc. Java home: c:\p4main\jdk142\jre Java classpath: c:\Derby_10\lib\derby.jar;c:\Derby_10\lib\derbytools.jar; c:\Derby_10\lib\derbyLocale_de_DE.jar;e:\Derby_10\lib\derbyLocale_es.jar; e:\Derby_10\lib\derbyLocale_fr.jar;c:\Derby_10\lib\derbyLocale_it.jar; e:\Derby_10\lib\derbyLocale_ja_JP.jar;e:\Derby_10\lib\derbyLocale_ko_KR.jar; e:\Derby_10\lib\derbyLocale_pt_BR.jar;e:\Derby_10\lib\derbyLocale_zh_CN.jar; e:\Derby_10\lib\derbyLocale_zh_TW.jar OS name: Windows 2000 OS architecture: x86 OS version: 5.0 Java user name: user1 Java user home: C:\Documents and Settings\myhome Java user dir: E:\p4main\systest\myrtst7 java.specification.name: Java Platform API Specification java.specification.version: 1.4 --------- Derby Information -------- JRE - JDBC: J2SE 1.4.2 - JDBC 3.0 [c:\Derby_10\lib\derby.jar] 10.1.1.0 - (190628) [c:\Derby_10\lib\derbytools.jar] 10.1.1.0 - (190628) ------------------------------------------------------ ----------------- Locale Information ----------------- Current Locale : [English/United States [en_US]] Found support for locale: [de_DE] version: 10.1.1.0 - (190628) Found support for locale: [es] version: 10.1.1.0 - (190628) Found support for locale: [fr] version: 10.1.1.0 - (190628) Found support for locale: [it] version: 10.1.1.0 - (190628) Found support for locale: [ja_JP] version: 10.1.1.0 - (190628) Found support for locale: [ko_KR] version: 10.1.1.0 - (190628) Found support for locale: [pt_BR] version: 10.1.1.0 - (190628) Found support for locale: [zh_CN] version: 10.1.1.0 - (190628) Found support for locale: [zh_TW]
java org.apache.derby.tools.sysinfo -cp [ [ embedded ][ server ][ client] [ tools ] [ anyClass.class ] ]
•
|
embedded
| |
•
|
server
| |
•
|
client
| |
•
|
tools
| |
•
|
classname.class
|
$ java org.apache.derby.tools.sysinfo -cp embedded SimpleApp.class FOUND IN CLASS PATH: Derby embedded engine library (derby.jar) NOT FOUND IN CLASS PATH: user-specified class (SimpleApp) (SimpleApp not found.)
java org.apache.derby.tools.dblook -d <databaseURL> [OPTIONS]
'jdbc:derby://localhost:1527/"C:\private\tmp\myDB" ;user=someusr;password=somepwd'
•
|
Checks
| |
•
|
Functions
| |
•
|
Indexes
| |
•
|
Jar files
| |
•
|
Keys (primary, foreign, and unique)
| |
•
|
Schemas
| |
•
|
Stored procedures
| |
•
|
Triggers
| |
•
|
Tables
| |
•
|
Views
|
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