JDBC driver for Adabas D

The JDBC driver

The driver implements the classes of the java.sql package. You can find a documentation of these classes at Javasoft

It needs a Java runtime environment of version 1.1 (or newer).

The name of the driver as used by the class loader is de.sag.jdbc.adabasd.ADriver. It will understand URLs in the form: jdbc:adabasd://servernode/serverdb where you should replace servernode and serverdb with the appropriate values.
Following the servernode there may be a port number separated by a colon. The default port of 7200 will be almost always appropriate to connect to the Adabas D Remote SQL server.

To create a connection to an Adabas D database server with this driver, you can use code like the following near the beginning of your program.

try {
  Class.forName("de.sag.jdbc.adabasd.ADriver");
} catch (ClassNotFoundException e) {
  System.out.println("JDBC driver for Adabas D not found");
};
try {
  java.sql.Connection con = java.sql.DriverManager.getConnection
      ("jdbc:adabasd://mycomp/MYDB", "USER", "PASSWD");
} catch (java.sql.SQLException e) {
  System.out.println("Error " + e.getErrorCode() + " " + e.getMessage());
};

Note, that the method getConnection() reaches the username and password to the database without translating them into upper case. Be sure to give the name in the correct case. Since all of the Adabas D tools convert unquoted names into upper case, the names may be expected in upper case, although you typed them in lower case in the query tool or on the command line.

The JDBC driver consists of a single archive adabasd.jar, which is located at $DBROOT/lib.

Applications using JDBC

For starting an application using this driver, make sure that your classpath contains the full path name of the jar file. An example follows, where the classpath is given explicitly as parameter. You can set the environment variable CLASSPATH to the value instead.

java -classpath /usr/lib/java/classes.zip:.:$DBROOT/lib/adabasd.jar JDBCApplication

Applets using JDBC

For creating a html page containing an applet using this driver, copy the jar file to the directory containing the other Java classes. Note, that this directory must be accessible by the internet server (e.g. Apache). Then you can use the ARCHIVE parameter of the APPLET tag. An example follows, where the classes are located in a subdirectory classes.

<APPLET CODEBASE="classes" ARCHIVE="adabasd.jar" CODE="JDBCApplet" ...>

There is a security restriction for applets, which states, that a network connection can only be opened to the host from which the applet itself was downloaded. Due to this restriction the web server distributing your applet code and the Adabas D database server, you want to open a connection to, must reside on the same host.

Foto Demo

There exists a demo of a Java class using this JDBC driver. This class can be used both as applet and application. Feel free to get your inspiration from this demo.

To install it, you have to do the following steps.

  1. Copy or link its content to a directory, where your http server can find it.
    cd /httpd/htdocs; ln -s $DBROOT/demo/eng/JDBC jdbc
  2. Compile the classes of the demo applet.
    cd /httpd/htdocs/jdbc/adabasd/demo; make
  3. Create a softlink in the classes subdirectory pointing to the jar file containg the Adabas D JDBC driver.
    cd /httpd/htdocs/jdbc/classes; ln -s $DBROOT/lib/adabasd.jar .
  4. Edit the file /httpd/htdocs/jdbc/index.html to adjust the parameters servernode, serverdb, user and password for your installation.

The list above is using /httpd/htdocs/jdbc as top level directory of the example. Of course you can use any other path name, as long as your http server will find it.

Now you can point your browser to http://myhost.mydomain/jdbc and enjoy the applet. To start the application, change directory into $DBROOT/demo/eng/JDBC and call

java -classpath /usr/lib/java/classes.zip:.:$DBROOT/lib/adabasd.jar adabasd.demo.Fotos

Note, that this demo looks nice only with the pictures of the demo database MYDB of the Linux version of Adabas D.