JDBC Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 2.11

"ij" - Client Tool to Create New Databases

This section describes how to use the command line tool 'ij' to create a new database with a new table.

"ij" is a command line client tool included in the Java DB package. You can use "ij" to run any SQL statements on the Java DB server. "ij" uses the JDBC driver to connect to the Java DB server with the "connect" command in this format:

connect 'jdbc:derby://<host>:<port>/<database>';
   Create a new database and connect to that database

connect 'jdbc:derby://<host>:<port>/<database>;create=true';
   Connect to an existing database

Here is how I used "ij" to create a new database and a new table:

C:\>\local\javadb\bin\ij
ij version 10.2

ij> connect 'jdbc:derby://localhost/TestDB;create=true';

ij> CREATE TABLE TestTable (ID INT, Name VARCHAR(20));
0 rows inserted/updated/deleted

ij> INSERT INTO TestTable VALUES (1, 'Herong');
1 row inserted/updated/deleted

ij> SELECT * FROM TestTable;
ID         |NAME
--------------------------------
1          |Herong

1 row selected
ij> quit;

Sections in This Chapter

Downloading and Installing Java DB (Derby)

"sysinfo" - Checking Java DB (Derby) Installation

Setting Up Java DB (Derby) in Network Server

"ij" - Client Tool to Create New Databases

Dr. Herong Yang, updated in 2007
"ij" - Client Tool to Create New Databases