IBM Books

Building Applications for UNIX** Environments


Java Sample Programs

DB2 provides sample programs, used in the following sections, to demonstrate building and running JDBC programs that exclusively use dynamic SQL, and SQLJ programs that use static SQL. The Java samples are located in the sqllib/samples/java directory. The directory also contains a README and a makefile. Please see the section "The Java makefile".

Before modifying or building the sample programs, it is recommended that you copy them from the sqllib/samples/java directory to a separate working directory.

To run these sample programs, you must first create and populate the sample database by entering:

   db2sampl

General Points for Building and Running DB2 Java Programs

  1. You must build and run DB2 Java applications and applets from a window where your environment variables are set. You can do this by running db2profile. Refer to "Setting Your Environment" if you need more information.

  2. To build DB2 SQLJ programs, or to run any DB2 Java programs, the database manager on the server must be started. Start the database manager, if it is not already running, by entering the following command on the server:
       db2start
    


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

[ DB2 List of Books | Search the DB2 Books ]