Building Applications for UNIX** Environments
DB2Appl demonstrates a dynamic SQL Java application using the
JDBC Application driver to access a DB2 database.
Command Line. To build and run this application by
commands entered at the command line:
- Compile DB2Appl.java with this command:
javac DB2Appl.java
to produce the file: DB2Appl.class.
- Run the java interpreter on the application with this command:
java DB2Appl
makefile. To build this application with the
makefile, and then run it:
- Ensure your environment includes a compatible make utility as specified in
the section "The Java makefile".
- Build the application with this command:
make DB2Appl
- Run the java interpreter on the application with this command:
java DB2Appl
DB2Applt demonstrates a dynamic SQL Java applet using the JDBC
applet driver to access a DB2 database.
Command Line. To build and run this applet by commands
entered at the command line:
- Ensure that a web server is installed on your DB2 machine (server or
client).
- Modify the DB2Applt.html file according to the
instructions there.
- Start the JDBC applet server on the TCP/IP port specified in
DB2Applt.html; for example, if in
DB2Applt.html, you specified:
param name=port value='6789'
then you would enter:
db2jstrt 6789
- Compile DB2Applt.java with this command:
javac DB2Applt.java
to produce the file DB2Applt.class.
- Ensure that your working directory is accessible by your web
browser. If it is not, copy DB2Applt.class and
DB2Applt.html into a directory that is accessible.
- Copy the file sqllib/java/db2java.zip into the same
directory as DB2Applt.class and
DB2Applt.html.
- On your client machine, start your web browser (which supports JDK
1.1) and load DB2Applt.html.
As an alternative to steps (1), (5) and (7), you can use the applet viewer
that comes with the Java Development Kit by entering the following command in
the working directory of your client machine:
appletviewer DB2Applt.html
makefile. To build this applet with the
makefile, and then run it:
- Ensure your environment includes a compatible make utility as specified in
the section "The Java makefile".
- Ensure that a web server is installed on your DB2 machine (server or
client).
- Modify the DB2Applt.html file according to the
instructions there.
- Start the JDBC applet server on the TCP/IP port specified in
DB2Applt.html; for example, if in
DB2Applt.html, you specified:
param name=port value='6789'
then you would enter:
db2jstrt 6789
- Build the applet with this command:
make DB2Applt
- Ensure that your working directory is accessible by your web
browser. If it is not, copy DB2Applt.class and
DB2Applt.html into a directory that is accessible.
- Copy the file sqllib/java/db2java.zip into the same
directory as DB2Applt.class and
DB2Applt.html.
- On your client machine, start your web browser (which supports JDK
1.1) and load DB2Applt.html.
As an alternative to steps (2), (6) and (8), you can use the applet viewer
that comes with the Java Development Kit by entering the following command in
the working directory of your client machine:
appletviewer DB2Applt.html
DB2Stp demonstrates how to write a dynamic SQL Java stored
procedure using the JDBC Application driver to access a DB2 database.
Command Line. To build and run this stored procedure by
commands entered at the command line:
- Compile DB2Stp.java with this command:
javac DB2Stp.java
This will produce the files DB2Stp.class and
DB2StpSample.class.
- Copy DB2StpSample.class to the
sqllib/function directory.
- Run the java interpreter on the stored procedure with this command:
java DB2Stp
makefile. To build this stored procedure with the
makefile, and then run it:
- Ensure your environment includes a compatible make utility as specified in
the section "The Java makefile".
- Build the stored procedure with this command:
make DB2Stp
- Run the java interpreter on the stored procedure with this command:
java DB2Stp
DB2Udf demonstrates implementing dynamic SQL user-defined
functions using the JDBC Application driver to access a DB2 database.
Command Line. To build and run this UDF program by
commands entered at the command line:
- Compile DB2Udf.java with this command:
javac DB2Udf.java
This will produce the files DB2Udf.class and
DB2UdfSample.class.
- Copy DB2UdfSample.class to the
sqllib/function directory.
- Run the java interpreter on the UDF program with this command:
java DB2Udf
makefile. To build this UDF program with the
makefile, and then run it:
- Ensure your environment includes a compatible make utility as specified in
the section "The Java makefile".
- Build the UDF program with this command:
make DB2Udf
- Run the java interpreter on the UDF program with this command:
java DB2Udf
[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]
[ DB2 List of Books |
Search the DB2 Books ]