SQLClient
Quick Start
SQLClient is a Java application. The main class for SQLClient is
com.ice.sqlclient.SQLClient. Assuming that your
current directory is the one you extracted from the archive, you
might use the following command to start the application:
Under UNIX:
java -classpath "classes:$CLASSPATH" com.ice.sqlclient.SQLClient
Or
Under Windows:
java -classpath "classes;%CLASSPATH%" com.ice.sqlclient.SQLClient
Details
In order to use SQLClient, you must provide for several items:
-
Java
You must has a 1.1 Java interpretter installed. Either the Sun
JDK1.1, or the Sun JRE1.1, or a commercial equivalent. I develop
with the Sun JDK1.1.5, and Symantec's javac compiler. I use the
Sun JRE1.1.5 for runtime. SQLClient should be fully compatible
with Java 2.
-
Java Foundation Classes (JFC or Swing)
You may find a copy at
Sun's web site.
-
JDBC Driver
You need a JDBC driver that is compatible with the database that
you with to access. If you do not have a database, I suggest you
investigate "MySQL". The classes folder contains the hSQL and
MM.MySQL drivers that are supported by this release of SQLClient.
-
SQL Database Server
Yes, you obviously need an SQL database that your driver can access.
This release has builtin support for MySQL and hSQL. If you add
support for a new DB, please send me the code so I can include it
in future releases.
Once you have met the above requirements, you must modify the
defaults.txt file so that SQLCLient knows
where you driver is, and other configuration items to make
the program display well.
The important properties to check are:
-
SQLClient.sqlPort
Default port number of the sql server.
-
SQLClient.sqlHostname
Default hostname of the sql server.
-
SQLClient.sqlUsername
Default user name to login to sql server.
-
SQLClient.sqlPassword
Default password to login to sql server.
-
SQLClient.sqlDatabase
Default database to login to.
-
SQLClient.sqlHandler
Default sql handler name. See note below about handlers.
You may define profiles to help you fill in
these values in the Host Info panel of the SQLClient
application. Each profile appears in the combobox in that panel,
allowing you to connect to any of a number of pre-defined databases.
The property SQLClient.profiles
lists the profiles. This is a colon
separated list of profile names. For each name in the list,
there must also be a profile definition property. The default
profile is defined by the property SQLClient.sqlProfile.
For each profile name in the list of profiles, there will be
a property named SQLClient.profile.PROFNAME,
where 'PROFNAME' is the profile's name.
Profiles are colon separated strings with fields:
- name
Name of profile displayed to user.
- hostname
Profile's hostname.
- port
Profile's port number.
- user
Profile's login user name.
- pass
Profile's login password.
- database
Profile's login database.
- handler
Profile's driver handler name.
SQLClient allows you to define any number of drivers. This
allows you to connect to entirely different databases without
having to reconfigure. Drivers are defined by properties with
the name SQLClient.jdbcDriver.N, where the
'N' is an integer from 1 to 100. Each driver property is a
colon separated string, where the fields are:
- HandlerClass
Currently, "MySQL" and "hSQL" are coded.
- HandlerName
The name shown to the user.
- DriverPrefix
The driver's prefix used in the JDBC URL.
- DriverClassName
The driver's full class name.
Finally, you can start SQLClient.
The main class is 'com.ice.sqlclient.SQLClient'.
You only need to include the sqlclient.jar file in your
classpath. Here is a typical invocation:
java -classpath $CLASSPATH:sqlclient.jar com.ice.sqlclient.SQLClient
Adding New DB Support
To add support for a new database to SQLClient, you have to perform several
steps.
- Create a client handler class similar to MySQLClient that extends
SQLClientHandler. This class knows how to open your database, as well
as perform some common requests that SQLClient works on. HSqlClient
is another example of a client handler.
- Add your client handler to those known to SQLClient by adding code
to the SQLClient.loadJDBCDrivers() method, similar to the code for
MySQL and hSQL.
- Add the properties to defaults.txt defining your driver mapping.
The property name is 'SQLClient.jdbcDriver.N', where N must be a
unique integer incrementing among all definitions. In other words,
SQLClient has a for loop where i = 1 to N loading driver properties
until it gets a null returned (no more defined). A gap in N will
prematurely end the list.
Copyright (c) 1998-2000 By Timothy Gerard Endres
SQLClient is licensed to you under the
GNU General Public License.