Some pointers on Java-based database access

The topic of database access from Java is a confusing one. In educating myself on the subject, I have found that the information is difficult to find, and fragmentary. This page summarizes some of the points which I have found useful, as notes to myself and to others. All of these notes are based on my understanding, so no guarantees are made as to the accuracy. If there are errors, please let me know and I will refund your purchase price ;-)


The first point is about the place of JDBC (Java DataBase Connection) in all of this. JDBC is an specification of how a Java program can connect to a database. It does not specify how that access occurs, for example, whether it uses ODBC or SQL. It does specify the form of results returning from the database (a ResultSet) and how to get information about the database and results (ResultSetMetaData). As such, it provides an implementation independent method of submitting commands to a database engine, and receiving results, as well as the format of the results. It does not specify the format of the command that is submitted.

In order to actually connect to the engine, you need a JDBC Driver. These are specific to each engine and type of connection. It may be possible to have multiple Drivers loaded at one time, but I have not been able to get it to work yet. It is possible to have different drivers which can handle connections to the same database engine, as is the case for mSQL (see below). The driver can be written entirely in Java, or may be written in some other language.

ODBC is a particular type of database connection interface (I believe it was developed by Microsoft). It is possible to make a JDBC-ODBC Driver, if ODBC connectivity is desireable. The main problem with this is that ODBC drivers are specific to the client machine (i.e., native), and JDBC-ODBC Drivers require a client specific Driver. This means that a) you need a different version for each potential client, and b) you can't make this type of connection from an applet, for security reasons.

One way around this is to add a third layer, which is a server side Java application. This application can have native code, since it is an application, and is only needed for the server machine. It can communicate with the client through a JDBC interface, and to the database engine through ODBC. I believe that dbAnywhere, and Kona are based on this structure, but I have not investigated them myself.

Hot Links

The following are links to database engines written in Java

This is a database engine written entirely in Java, with JDBC drivers as well. It supports prepared statements and "ORDERED BY", but does not currently support LONGVARCHAR. My understanding of the license is that it is free for personal or internal use. Developed at the NCSA.
This is a database engine and JDBC drivers written entirely in Java. It is primarily a demonstration engine for the book by the author, in order to demonstrate the principles of JDBC. It has two drivers, one of which is to a text-file based database engine (included), and the other is for read-only access to "DBF" files coming from some xBase engine. Does not support prepared statements or ordering.
This is a database engine written entirely in Java. From my limited examination, it appears not to use SQL, so I limited my further evaluation, since I was looking for a SQL engine. I believe that it has a fairly liberal licensing policy.

The following are links to other database engines

mSQL Database Engine
This is a database engine for unix and Windows NT, written in C. It is fairly full-featured, but does not support prepared statements. There are two JDBC drivers for connecting to mSQL. (See below). Usage is free for educational and non-profit institutions, there is a very nominal licensing fee for others.
ImSQL JDBC connection
This is a JDBC connection for mSQL. I have not investigated the licensing options.
This is a database engine for unix, written in C. It is full-featured, and does support prepared statements. I have not found a JDBC interface to it yet, although there are Java interfaces and ODBC drivers. I believe that it is useable without a fee. There are intersting links at this site to a large number of database projects in unix.

Hope this helps. Enjoy!

If you have comments or suggestions, email me at

This page created with Netscape Navigator Gold