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.
Hope this helps. Enjoy!
If you have comments or suggestions, email me at firstname.lastname@example.org
This page created with Netscape Navigator Gold