IBM Books

Building Applications for UNIX** Environments


Building and Running a JDBC Application

You do not precompile or bind Java programs.

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 CAE to communicate the requests to the server and receive the results.

A sample application, DB2Appl.java, is provided in the sqllib/samples/java directory. If you installed the DB2 SAMPLE database, you can run the sample by changing to the sqllib/samples/java directory, and doing the following:

  1. Start the database manager on the server, if it is not already running, by entering:
    db2start
    

  2. Enter:
    javac DB2Appl.java
    java DB2Appl
    

As an alternative to step 2 above, you can use the pre-compiled version of DB2Appl.java in samples.zip. To do this, ensure CLASSPATH also includes the file sqllib/samples/java/samples.zip. Then, run the java interpreter on the application by entering:

java DB2Appl


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

[ DB2 List of Books | Search the DB2 Books ]