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. On UNIX platforms, the Java samples are located in sqllib/samples/java. On OS/2 and Windows 32-bit operating systems, the samples are located in %DB2PATH%\samples\java. The samples directory also contains a README, a makefile, and build files.
The Java makefile builds all the supplied sample programs. It requires a compatible make executable program, which is not normally provided by Java Development Kits. See the comment at the beginning of the text of the makefile for more information. Some of the Java makefile commands differ from other languages: the make clean command removes all files produced by the java compiler, such as .class files. The make cleanall command removes these files as well as any files produced by the SQLJ translator.
The JDBC programs are relatively simple to build on the command line so no build files are included for them. There are two SQLJ build files provided: bldsqlj builds SQLJ applets and applications; bldsqljs builds SQLJ stored procedures. These build files are demonstrated in the section "SQLJ Programs".
OS/2
On OS/2, your working directory must be on an HPFS drive. Since DB2 sample programs are provided on OS/2 to be compatible with FAT drives, filenames have at most a three character extension. To comply with this restriction, Java sample file extensions have been truncated. After copying the Java files to your working directory, you can rename the files with the following commands:
move *.jav *.java move *.htm *.html move *.sql *.sqlj