******************************************************************************
* (c) Copyright IBM Corp. 2007 All rights reserved.
* 
* The following sample of source code ("Sample") is owned by International 
* Business Machines Corporation or one of its subsidiaries ("IBM") and is 
* copyrighted and licensed, not sold. You may use, copy, modify, and 
* distribute the Sample in any form without payment to IBM, for the purpose of 
* assisting you in the development of your applications.
* 
* The Sample code is provided to you on an "AS IS" basis, without warranty of 
* any kind. IBM HEREBY EXPRESSLY DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR 
* IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Some jurisdictions do 
* not allow for the exclusion or limitation of implied warranties, so the above 
* limitations or exclusions may not apply to you. IBM shall not be liable for 
* any damages you suffer as a result of using, copying, modifying or 
* distributing the Sample, even if IBM has been advised of the possibility of 
* such damages.
*
******************************************************************************
*
*               README for JDBC Samples on Unix
*
* The <install_path>/sqllib/samples/java/jdbc directory contains this README 
* file. Where <install_path> is the location of DB2 9.7 on your hard drive.
* The default location for <install_path> is
*               $HOME
*
* This README describes how to build and run jdbc sample code for DB2 9.7.
* The DB2 9.7 jdbc samples are located in the following directory:
*    <install_path>/sqllib/samples/java/jdbc 
*
* Copy the files from this directory to your working directory prior to
* building the sample programs. The sample programs directory is
* typically read-only on most platforms and some samples produce output
* files that require write permissions on the directory.
*
* WARNING: Some of these samples may change your database or database
* manager configuration.  Execute the samples against a test database
* only, such as the DB2 SAMPLE database.
*
******************************************************************************
*
*           Prepare your DB2 sample development environment
*
*  1) Copy the files in <install_path>/sqllib/samples/java/jdbc/* to your
*     working directory and ensure that directory has write permission.
*
*  2) Modify the CLASSPATH to include:
*         <install_path>/sqllib/java/db2java.zip
*         <install_path>/sqllib/java/db2jcc.jar
*         <install_path>/sqllib/java/db2jcc_license_cu.jar
*         <install_path>/sqllib/java/<jdkDirName>/lib
*         <install_path>/sqllib/lib
*         <install_path>/sqllib/function
*         <install_path>/sqllib/java/sqlj.zip
*     where <jdkDirName> is the name of the
*     jdk directory under <install_path>/sqllib/java.
*
*     Modify the PATH to include <install_path>/sqllib/java/<jdkDirName>/bin,
*     <install_path>/sqllib/lib.
*
*     Please make sure that JDK_PATH( db2
*     database manager  configuration parameter) is
*     pointing to the <install_path>/sqllib/java/<jdkDirName>.
*
*     To see the dbm cfg parameter value, run the following from db2
*     command window and look for the value of JDK_PATH
*       db2 get dbm cfg
*
*  3) Start the Database Manager with the following command:
*       db2start
*
*  4) Create the sample database with the following command:
*       db2sampl    
*
*  5) Connect to the database with the following command:
*       db2 connect to sample
*
*  6) To build Stored Procedures and User Defined Functions, ensure
*     that you have write permission on the
*    <install_path>/sqllib/function directory.
*
*  7) cd to the directory containing the files copied in step 1.
*
******************************************************************************
*
*                              Building DB2 Samples
*
*   There are two ways to build DB2 samples: using a make utility or
*   using javac compiler.
*
*        o To build samples using the make utility see
*          'BUILDING SAMPLES USING make UTILITY'.
*        o To build samples using the javac compiler or when you do not
*          have a compatible make utility see 'BUILDING
*          SAMPLES USING JAVAC COMPILER'.
*
******************************************************************************
*
*                 *** BUILDING SAMPLES USING make UTILITY ***
*
*      If you have a compatible make utility on your system, you
*      can use the makefile provided. Modify the PATH
*      variable to include the directory containing the make
*      utility.
*
*      Depending on your environment, the makefile might have to be
*      modified.For more details refer to the 'VARIABLES' section
*      in the makefile.
*
*      Execute the appropriate 'make' command in your working
*      directory:
*
*          o make <program name> - builds the sample identified by
*            <program name>
*            Do not include the file extension for the
*            program name.  E.g. make DbAuth
*            For any dependencies refer to the individual sample.
*
*          o make srv   - builds only samples that can be run on the
*            server,including routines (stored procedures and User
*            Defined Functions).
*
*          o make rtn   - builds only routines.
*
*          o make call_rtn - builds only client programs that call
*            routines.
*
*          o make client_run - builds only programs that run
*            completely on the client (not ones that call routines).
*
*          o make all_client  - builds all client samples (all
*            programs in the  'call_rtn' and 'client_run' categories).
*
*          o make all - builds all supplied sample programs including
*            routines, stored procedures and UDFs.
*
*          After compiling the sample, run it using normal java
*          invocation,   java  <program_name>
*
*     Note:
*       The makefile provided will only work if a compatible make
*       executable program is resident on your system in a directory
*       included in your PATH variable. Such a make utility may be
*       provided by another language compiler.
*
******************************************************************************
*
*                  *** BUILDING SAMPLES USING JAVAC COMPILER ***
*
*          As an alternative to the makefile, the javac compiler
*          can be used to build the jdbc samples.
*
*          If you do not have a compatible make utility you can use
*          the javac bytecode compiler to build JDBC programs.
*
*      Building and Executing Standalone Samples
*      -----------------------------------------
*
*         o Build the general utility class called Util.java. 
*               javac Util.java
*
*         o Build the sample program
*               javac <program name>.java
*
*         o After compiling the sample, run it using normal java
*           invocation
*               java  <program_name>
*
*      Building and Executing Stored Procedures
*      ----------------------------------------
*
*         o Build the server file sample using:
*               javac <Ser_prog_name>
*               copy the resulting .class file
*               to the sqllib/function directory.
*
*         o Build jdbc store procedure using build file:
*               spcat
*
*         o Build the corresponding client file sample using:
*               javac  <Client_prog_name>.java
*
*         o Run the client sample using normal java invocation:
*               java  <Client_prog_name>
*
*      Building and Executing User Defined Functions:
*      ----------------------------------------------
*
*        o Build the server file sample using:
*                javac <Ser_prog_name>
*                copy the resulting .class file
*                to the sqllib/function directory.
*
*        o Build the User Defined Functions using build files:
*                udfcat or udfjcat
*
*        o Build the corresponding client file sample using:
*                javac  <Client_prog_name>.java
*
*        o Run the client sample using normal java invocation:
*                java  <Client_prog_name>
*
******************************************************************************
*
*              Common file Descriptions
* 
* The following are the common files for JDBC samples. For more
* information on these files, refer to the program source files.
*
******************************************************************************
*
* Common files
*
* README        - this file!
* makefile      - Makefile for all files
* Util.java     - utilities used by most programs
*
******************************************************************************
*
*               JDBC Samples Design
*
* The JDBC sample programs form an object-based design reflecting the
* component nature of DB2. Related samples demonstrate a specific level
* of database programming. Each level is identified by the first two
* characters of the sample name. Here are the database levels
* represented by the samples:
*
* Identifier     DB2 Level
*
*     Ap        Applet Level.
*     Il        Installation Image Level.
*     Db        Database Level.
*     Tb        Table Level.
*     Dt        Data Type Level.
*     Ud        UDF Level.
*     Sp        Stored Procedure Level.
*
* Also, there are tutorial samples that demonstrate how to implement
* Java GSS-API Plugin and how to use the plugin to get a DB2 connection
* using IBM DB2 Universal Driver (JCC driver). These programs begin
* with "JCC".
*
******************************************************************************
*
*               JDBC Sample Descriptions
*
* The following are the JDBC sample files included with DB2. For more
* information on the sample programs, refer to the program source
* files.
*
******************************************************************************
*
* Applet Level
*
* Applt.html    - HTML file for Applt.java
* Applt.java    - How to create applets
*
******************************************************************************
*
* Installation Image Level
*
* IlInfo.java    - How to get and set installation level information.
*
******************************************************************************
*
* ADMIN_CMD stored procedure samples (program files that deal with
* using SQL ADMIN_CMD() Stored Procedures)
*
* AdmCmdAutoCfg.java       - How to autoconfigure a database
* AdmCmdContacts.java      - How to add, update and drop contacts and
*                            contactgroups
* AdmCmdDescribe.java      - How to describe table and indexes
* AdmCmdExport.java        - How to export data
* AdmCmdImport.java        - How to import data
* AdmCmdOnlineBackup.java  - How to perform online backup
* AdmCmdQuiesce.java       - How to quiesce tablespaces and database
* AdmCmdUpdateCfg.java     - How to update, reset Database and Database
*                            Manager Configuration Parameters
******************************************************************************
*
* Database Level
*
* DbAuth.java          - How to grant/display/revoke authorities at
*                        database level.
* DbConn.java          - How to connect and disconnect from a database.
* DbInfo.java          - How to get and set information at a database
*                        level.
* DbMCon.java          - How to connect and disconnect from multiple
*                        databases.
* DbNative.java        - How to translate a statement that contains an
*                        ODBC escape clause to a data source specific
*                        format.
* DbRsHold.java        - How to use result set cursor holdability
* DbSeq.java           - How to create, alter and drop a sequence in a
*                        database.
* DbUse.java           - How to work with database objects.
* GetDBCfgParams.java  - How to get DB CFG Parameters.
* GetDBMCfgParams.java - How to get DBM CFG Parameters.
* GetLogs.java         - How to get customer view of diagnostic log
*                        file entries.
* TrustedContext.java  - How to establish an explicit trusted connection and
*                        switching of the user.
*
******************************************************************************
*
* Table Level
*
* GetMessage.java     - How to get error message in the required locale
*                       with token replacement.
* ImplicitCasting.java- To demonstrate use of implicit casting.
* LargeRid.java       - How to enable Large RIDs support on both new
*                       tables/tablespaces and existing
*                       tables/tablespaces.
* SetIntegrity.java   - How to perform online SET INTEGRITY on a table.
* ScalarFunctions.java- How to use scalar functions and special register.
* TbAST.java          - How to use staging table for updating deferred
*                       AST.
* TbCompress.java     - How to create tables with null and default
*                       value compression option.
* TbConstr.java       - How to work with table constraints.
* TbCreate.java       - How to create, alter, and drop tables.
* TbGenCol.java       - How to use generated columns.
* TbIdent.java        - How to use identity columns.
* TbMerge.java        - How to use the MERGE statement.
* TbInfo.java         - How to get and set information at a table
*                       level.
* TbInTrig.java       - How to use INSTEAD OF triggers.
* TbMod.java          - How to modify information in a table.
* TbOnlineInx.java    - How to create and reorg indexes on a table.
* TbPriv.java         - How to grant/display/revoke privileges at a
*                       table level.
* TbRead.java         - How to read information in a table.
* TbRowcompress.java  - To demonstrate row compression and automatic 
*                       dictionary creation on a table
* TbRunstats.java     - How to perform runstats on a table.
* TbSel.java          - How to select from each of: insert, update,
*                       delete.
* TbTemp.java         - How to use Declared Temporary Table.
* TbTrig.java         - How to use a trigger on a table.
* TbUMQT.java         - How to use user materialzed query tables
*                       (summary tables).
* TbUnion.java        - How to insert through a UNION ALL view.
*
******************************************************************************
*
* Data Type Level
*
* DtInfo.java    - How to get information on data types.
* DtLob.java     - How to read and write LOB data.
* DtUdt.java     - How to create/use/drop user defined distinct types.
*
******************************************************************************
*
* UDF Level
*
* UDFcli.java    - Call the UDFs in UDFsrv.java.
* UDFCreate.db2  - CLP script to catalog the Java UDFs contained in
*                  UDFsrv.java.
* UDFDrop.db2    - CLP script to uncatalog the Java UDFs contained in
*                  UDFsrv.java.
* UDFjcli.java   - Call the UDFs in UDFjsrv.java.
* UDFjCreate.db2 - CLP script to catalog the Java UDFs contained in
*                  UDFjsrv.java.
* UDFjDrop.db2   - CLP script to uncatalog the Java UDFs contained in
*                  UDFjsrv.java.
* UDFjsrv.java   - Provide UDFs to be called by UDFjcli.java.
* UDFsCreate.db2 - CLP script to catalog the Java UDFs contained in
*                  UDFsqlsv.java.
* UDFsDrop.db2   - CLP script to uncatalog the Java UDFs contained in
*                  UDFsqlsv.java.
* UDFsqlcl.java  - Call the UDFs in UDFsqlsv.java.
* UDFsqlsv.java  - Provide UDFs to be called by UDFsqlcl.java.
* UDFsrv.java    - Provide UDFs to be called by UDFcli.java.
*
******************************************************************************
*
* Stored Procedure Level
*
* SpCreate.db2  - CLP script to issue CREATE PROCEDURE statements.
* SpDrop.db2    - CLP script to drop stored procedures from the
*                 catalog.
* SpClient.java - Client application that calls the stored procedures.
* SpServer.java - Stored procedure functions built and run on the
*                 server.
* bonus_calculate.db2 - CLP script to issue CREATE PROCEDURE for
*                       Arrays_Sqlpl.java.
* stack_functions.db2 - CLP script to issue CREATE PROCEDURE for
*                       Array_Stack.java sample.
* Arrays_Sqlpl.java   - Client application that calls the SQL stored
*                       procedure created in bonus_calculate.db2.
* Array_Stack.java    - Client application that calls the SQL stored
*                       procedure created in stack_functions.db2.
*
******************************************************************************
*
* Java Beans Samples
*
* CreateEmployee.java   - How to create an employee record.
* GeneratePayroll.java  - How to generate payroll reports by
*                         department.
*
******************************************************************************
*
* Java GSS-API Plugin Samples
*
* JCCKerberosPlugin.java      - How to implement a GSS-API Plugin that
*                               does Kerberos authentication using IBM
*                               DB2 Universal Driver.
* JCCKerberosPluginTest.java  - How to use JCCKerberosPlugin to get a
*                               DB2 Connection using IBM DB2 Universal
*                               Driver.
* JCCSimpleGSSPlugin.java     - How to implement a GSS-API Plugin that
*                               does userid and password checking using
*                               IBM DB2 Universal Driver.
* JCCSimpleGSSContext.java    - implement a GSSContext to be used by
*                               JCCSimpleGSSPlugin
* JCCSimpleGSSCrednetial.java - implement a GSSCredential to be used by
*                               JCCSimpleGSSPlugin
* JCCSimpleGSSException.java  - implement a GSSException to be used by
*                               JCCSimpleGSSPlugin
* JCCSimpleGSSName.java       - implement a GSSName to be used by
*                               JCCSimpleGSSPlugin
* JCCSimpleGSSPluginTest.java - How to use JCCSimpleGSSPlugin to get a
*                               DB2 Connection using IBM DB2 Universal
*                               Driver.
*
******************************************************************************