You can use a Java™ makefile or
manually execute the javac command to build JDBC applications.
The following steps demonstrate how to build and run the Applt.java sample
JDBC applet.
- Compile Applt.java to produce the file Applt.class with
this command:
javac Applt.java
- Ensure that your working directory is accessible by your
web browser, or by your Java applet
viewer, if you are using it. If your directory is not accessible,
copy the following files into a directory that is accessible:
- Copy sqllib\java\db2jcc.jar on Windows or sqllib/java/db2jcc.jar on UNIX, into the same directory as Applt.class and Applt.html.
If you are using any JDBC 4.0 or later functions, copy
db2jcc4.jar instead of db2jcc.jar.
- If you are using the IBM® Data Server Driver for JDBC and SQLJ,
connect with that driver by modifying the Applt.html file
according to the instructions in the file. For the TCP/IP port number,
you should use the database port number 50000.
- To run this applet, ensure that a web server is
installed and running on your DB2
server or client, or use the applet viewer that comes with
the SDK for Java by entering
the following command in the working directory of your client machine:
appletviewer Applt.html