OverviewScheduleResourcesAssignmentsHome

CSC 381: Database and File Systems, Fall 2007

SQuirreL SQL Instructions

The installer for version 2.5 of the SQuirreL SQL Universal SQL Client is available on the campus network drives at I:\10708_CSC381\public\squirrel-sql-2.5-install.jar, or can be downloaded from http://www.squirrelsql.org/#installation. It is an executable jar file, so you may be able to just double-click it and follow the installation steps. Alternately, execute java -jar squirrel-sql-2.5-install.jar from a command line.

You will need at least Java 1.5 to use this version of SQuirreL SQL. If you have the Java 1.6 SDK (the latest version available for Windows and Linux at the time I write this), then you will also have the JavaDB embedded database already installed. If not, you will need to install the latest version of the Apache Derby database (JavaDB is just a repackaged version of Derby).

For our purposes, you may just choose the Standard plugins when installing SQuirreL SQL, although you might wish to explore some of the others (for example, the optional Derby plugin enables browsing some more details of a Derby database). When the installation is complete, go to the directory where it was installed and launch squirrel-sql.bat (Windows), squirrel-sql.sh (Linux), or SquirrelSQL.app (Mac).

The client window will initially show two sub-windows, titled "Drivers" and "Aliases". The first time you launch the program, there will probably be a red X next to the "Apache Derby Embedded" entry in the Drivers window. Double-click on that line, and in the resulting "Change Driver" window, select the tab labeled "Extra Class Path". Now click the "Add" button and browse to the directory containing the Derby jar files. On Windows, this might be C:\Program Files\Java\jdk1.6.0\db\lib\, or it might be C:\Program Files\Sun\JavaDB\lib\ (the location changed with Update 2 of the Java 1.6 JDK); on other systems, try typing locate derby.jar at a command line. Once you have found the correct directory, choose derby.jar and click "Open" to add it to the extra class path. If you are successful, the status window will show a green message saying that the Apache Derby Embedded driver has been registered.

To connect to a database, you need to create an alias. Click on the "+" icon in the Aliases window and fill in the resulting dialog box. The name can be anything, the driver should be "Apache Derby Embedded", and the URL should be something like jdbc:derby:C:\Databases\MyDB;create=true (replace the C:\Databases\MyDB part with whatever directory you want to use). You do not need a user or password for an embedded server. Click "Test" and then "Connect" and it should tell you that the connection is successful (after this, you will not need the ;create=true part of the URL, but it will not hurt to leave it there).

Now you may double-click on the alias you just created to bring up a window allowing you to browse your database. To test it, go to the "SQL" tab and enter the following:

create table TEST (
    name varchar(20),
    id int not null,
    primary key (id)
)
		

Hit Ctrl-Enter to run the query. If it was successful, you should see a green line in the status area, and a table named "TEST" should appear in the "Objects" tab under the category "APP/TABLE". If you right-click on the table name in that tree view, one of the available commands should be "Add to graph", which will allow you to visualize the graph structure of your database (add several tables to the same graph and it will show you foreign key relationships between the tables). Finally, if you go to the "Content" tab of the "Objects" view for your table, you can view the contents of the table; if you right-click in that area and choose "Make Editable", then you will be able to add rows (right-click again) or change the contents of the table.

OverviewScheduleResourcesAssignmentsHome

Valid HTML 4.01!Valid CSS!DePauw University, Computer Science Department, Fall 2007
Maintained by Brian Howard (bhoward@depauw.edu). Last updated