Sunteți pe pagina 1din 7

1.

SQuirrel SQL Client: A open source front end to


interact with CSQL database
This chapter draws an open source application called SQuirrel SQL Client that provides
an easy-to-use interface to CSQL as well as a list of other vendor databases like MySQL,
PostgreSQL, Oracle, Sybase, SQL Server and DB2.

1.1. What is SQuirrel SQL Client?


SQuirrel, a graphical front end is built to support JDBC-compliant databases, is coded in
Java that can ease development efforts by allowing the developer to peek at database
contents and also view the contents of tables. Additionally, SQuirrel’s well-disposed GUI
provides a SQL area within which user can execute and test out SQL commands.

1.2. Prerequisites
Before we start talking about the usage of SQuirrel, let’s download and install it in your
machine.

1.2.1. Supported Java Version


You need to have Java 1.6x installed in your machine to run SQuirrel SQL Client.
Follow the SQuirrel Client Home Page http://squirrel-sql.sourceforge.net/ to get more
information about the required Java version.

1.2.2. Download
Any of the squirrel-sql-xxxf-install.jar files can be downloaded from
http://squirrel-sql.sourceforge.net/ . At the time of writing this manual, SQuirrel Client’s
version is 2.6.9.

1.2.3. Installing SQuirrel


After downloading the package, go to your appropriate directory and issue the below
command,

$java –jar squirrel-sql-<version>-install.jar

Doing so will bring up a new directory named SQuirrelSQLClient


SQuirrelSQLClient in your home
directory. In this manual, the directory is /home/Lakshya/SQuirrelSQLClient.
.

Note: Open up one terminal in your machine, go to your CSQL root


directory and start the CSQL database server before starting SQuirrel
Client.

www.csqldb.com 1 CSQL Programmers’ Guide


1.3. Starting up SQuirrel
1.3.1. Setting up the environmental variables and classpath
In another terminal, execute the $. ./setupenv.ksh file to set CSQL’s environmental
variables and class path, which is required for JDBC Driver.

$. ./setupenv.ksh

1.3.2. Open up the SQuirrel Client Screen


After running setup script, go to your SQuirrelSQLClient directory, and execute the
squirrel-sql.jar file.

$cd SQuirrelSQLClient
$java –jar squirrel-sql.jar

After getting this screen, now the job is to create a Driver and Alias in SQuirrel to work
with CSQL databases.

1.4. Create a Driver in SQuirrel


Go to Drivers in the main toolbar and select New Driver from the drop-down menu, a
pop-up titled Add Driver appears. Configure your driver following below steps:

 Name: Type in the name you want here for the driver (Example --
CsqlEmbedded)
 Example URL: jdbc: csql
 Click on ‘Extra
Extra Class Path’ tab and on the ‘Add’ button, Select the
<csql_driver>.jar file, which is present in /csql/install/lib directory
(Illustrated in Figure 2a.)

www.csqldb.com 2 CSQL Programmers’ Guide


Figure:2a.
Figure:2a. Create a New Driver

 Return to the ‘Java Classpath’ tab, at the bottom, there is a drop-down box. Paste
the following class name: csql.jdbc.JdbcSqlDriver (Illustrated in Figure 2b.)
 Click OK

1.5. Create a New Alias


To interact with database using SQuirrel, you have to create an Alias. Go to Aliases in the
main toolbar and select New Alias from the drop-down menu. In the resulting pop-up:

 Name: Type a name of your choice for the alias (In Figure 3. -- it is
CSQLEmbeddedAlias).
 Driver: choose the driver that you configured above URL.(it is CsqlEmbedded)
 URL: jdbc:csql

www.csqldb.com 3 CSQL Programmers’ Guide


 User Name: user name will be “root” to access CSQL database
 Password: It will be “manager”
 Click OK

Figure 3.
3 Create a New Alias

 Now you will see your newly created Alias in the Alias Scrollable list.(In Figure
4)
 Double click the Alias that you created (CSQLEmbeddedAlias). A pop-up will
appear
 Click on Connect (Figure 4.)
 Now it is connected to the CSQL database

www.csqldb.com 4 CSQL Programmers’ Guide


Figure 4. Connect to CSQL database

1.6. Access to database


Now you will face a window (Figure 5.) that represents the configured database. On the
left-hand pane, you can view the tables, the schema of the tables and the contents of the
tables.

To execute SQL queries, select the SQL tab, enter your query, select the query and click
on the running-man icon. You will see the results of your SQL statements in the resulting
pane (Figure 6.)

www.csqldb.com 5 CSQL Programmers’ Guide


Figure 5. Table View

Figure 6. Executing SQL Queries

www.csqldb.com 6 CSQL Programmers’ Guide


SUMMARY
Running essential applications in SQuirrel SQL Client is a matter of configuring the class
path and defining a run configuration.

www.csqldb.com 7 CSQL Programmers’ Guide

S-ar putea să vă placă și