"How To" Guides for MySQL

Start the Derby Interactive SQL Tool

java -cp "c:\jdk1.6.0_01\db\lib\derby.jar;c:\jdk1.6.0_01\db\lib\derbytools.jar" org.apache.derby.tools.ij
ij version 10.2
ij>

Show available commands

ij> help;

Connection commands

Create a database:

ij> connect 'jdbc:derby:C:/Documents and Settings/username/.derby/dbname;create=true';

To drop a database, simply remove the directory:

rmdir /s "%USERPROFILE%\.derby\dbname"

Connect to an existing database:

ij> connect 'jdbc:derby:C:/Documents and Settings/username/.derby/dbname';
ij> connect 'jdbc:derby:C:/Documents and Settings/username/.derby/dbname' as connname;

The default connection name is "CONNECTIONn", where n is numeric.

Show information about established connections:

ij> show connections;

Switch to a different connection:

ij> set connname;

Disconnect a connection:

ij> disconnect current;
ij> disconnect connname;

Schema commands

Create a schema

ij> create schema schemaname;
ij> create schema "SchemaName";

Show available schemas

ij> show schemas;

Change schemas

ij> set current sqlid schemaname;
ij> set current sqlid = "SchemaName";

Commands for Tables in Database

Show tables in schema

ij> show tables in sys;
ij> show tables in schemaname;
ij> show tables in "SchemaName";

Similarly, "views", "procedures" "synonyms" and "indexes" can also be displayed.

Show indexes for a table

ij> show indexes from tablename;
ij> show indexes from schemaname.tablename;
ij> show indexes from "SchemaName"."TableName";

Last updated Saturday January 31, 2009


Printer-friendly PDF* format:

How To Guides for MySQL

This Section

You are currently viewing this page in XHTML 1 Style Sheet* format (* see Clicklets for more infomation). This document is also available in XHTML 1*XML*HTML 4*HTML 5 Style Sheet*HTML 5 XML*HTML 5 non-XML* XHTML 2* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.