IBM Books

Quick Beginnings for DB2 Extended Enterprise Edition for UNIX

Running Java Programs

You can use DB2 Java Database Connectivity (JDBC) support to run the following types of Java programs:

Java can also be used on the server to write user-defined functions, stored procedures, and table functions.

For further information on developing Java applications that access DB2 databases refer to the Web page located at and the Road Map to DB2 Programming.

Configuring the Environment

The following environment variables must be set to run Java programs:

OS/2, Windows 95 and Windows NT

In the following settings instance_name is the home directory of the DB2 instance owner.

Java Applications

Start your application from the desktop or command line, like any other application. The DB2 JDBC driver handles the JDBC API calls from your application and uses the DB2 Client Application Enabler to communicate the requests to the server and receive the results.

Java Applets

Because Java applets are delivered over the Web, you treat them a bit differently than Java applications. You must install DB2 (server or client) on the same machine as your Web server, then install the Java Development Kit (JDK) Version 1.1 from Sun Microsystems on the server as well (refer to for details).

To run your applet, you need only a Java-enabled Web browser on the client machine. When you load your HTML page, the applet tag downloads the Java applet to your machine, which then downloads the Java class files, including the and classes and DB2's JDBC driver. When your applet calls the JDBC API to connect to DB2, the JDBC driver establishes separate communications with the DB2 database through the JDBC applet server residing on the DB2 server.

To run your applets, do the following:

  1. Start the DB2 JDBC applet server on your Web server by entering:
    db2jstrt portno

    where portno is the number of the unused TCP/IP port that you specified in the file.

  2. On your client system, start your Web browser and load the HTML file that imbeds your applet.

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]