*****************************************************************************
* (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 Visual Basic (VB) .NET Samples
*
* The <install path>sqllib\samples\.NET\vb directory contains this README
* file where <install_path> is the location of DB2 9 on your hard drive. The
* default location for <install_path> is C:\Program Files\IBM
*
* This README describes how to build and run Visual Basic (VB) .NET sample
* code for DB2 9. The DB2 9 sample code and build files for VB .NET are
* located in the following directory:
*
*    <install_path>\sqllib\samples\.NET\vb
*
* Copy the sample files from this directory to a working directory prior to
* building the sample programs. The sample program directories are typically
* read-only on most platforms and some samples produce output files that
* require write perimssions 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.
*
*  To access, build, and run the DB2 VB.NET sample programs under the
*  <install path>sqllib\samples\.NET\vb directory, you must:
*
*  1. Install the Microsoft .NET Framework SDK and the Microsoft
*     .NET Framework Redistributable
*
*     Note: 1. To compile and run the stored procedure samples, you must have
*              Version 1.1 or later of the .NET Framework installed.
*           2. To compile and run the XML samples, you must have
*              Version 2.0 or later of the .NET Framework installed.
*
*  2. Install the Microsoft .NET Framework Service Pack 2
*
*****************************************************************************
*
*               Prepare your DB2 sample development environment
*
*   All samples should be run and built in a DB2 Command Window. The DB2
*   Command Window is needed to execute the db2 specific commands.
*   Listed below is how to opening the DB2 Command Window
*
*   o From the Start Menu click Start --> Programs --> IBM DB2 -->
*    <DB2 copy name> --> Command Line Tools --> Command Window
*
*   o If DB2 Version 8 is installed on your system the following 2 methods
*     will open a Version 8 command window. If you do have DB2 Version 8
*     please use the method above to open a Command Window.
*     o From the Start Menu click Start --> Run
*         Type 'db2cmd' in the dialog and click "OK"
*
*     o From a Command Prompt run the following command:
*         db2cmd
*
*         This Opens the CLP-enabled DB2 window, and initializes the DB2
*         command line environment. Issuing this command is equivalent to
*         clicking the DB2 Command Window as above.
*
*  1) Copy the files in <install path>sqllib\samples\.NET\vb\* to a working
*     directory and ensure that directory has write permission.
*
*  2) SET DB2PATH to the location of your DB2 9 on your hard drive.
*     The default location is C:\Program Files\IBM
*
*  3) Start the Database Manager with the following command:
*       db2start
*
*  4) Create a sample database:
*        - For XML samples you need to use the XML sample
*          database which can be created using the following
*          command:
*
*              db2sampl -xml
*
*          WARNINGS
*            1. XML data can only be stored in single-partition databases.
*               Note that using XML features prevents future use of the
*               Database Partitioning Feature available with DB2 Enterprise
*               Server Edition for Linux, UNIX, and Windows. 
*            2. These steps gives an overview of building and running the
*               samples. Please read the README in corresponding directory
*               for any specific considerations.
*
*        - Non-Xml samples require the v8 sample database 
*          which can be created using the following command:
*
*              db2sampl -v8
*
*  5) Test that you can 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 nmake utility or using
*  the build files that are included with the DB2 sample programs.
*
*        o To build samples using the nmake utility see
*          'BUILDING SAMPLES USING nmake UTILITY'.
*        o To build samples using the build files or when you do not
*          have a compatible nmake utility
*          see 'BUILDING SAMPLES USING BUILD FILES'.
*
*****************************************************************************
*
*                 *** BUILDING SAMPLES USING nmake UTILITY ***
*
*       If you have a compatible nmake utility on your system, you can use
*       the makefile provided. Such a nmake utility may be provided by
*       another language compiler. Modify the PATH variable to include the
*       directory containing the nmake utility. The .NET v2.0 SDK and
*       Visual Studios 2003 & 2005 come with nmake. If your PATH variable
*       is not set to use nmake with a Windows command prompt you can open
*       a .NET command Prompt. To do this:
*
*       o If Visual Studio 2003/2005 is installed
*           From the Start Menu: click Start --> Programs
*           --> Microsoft Visual Studio 2003/2005 --> Visual Studio .NET Tools
*           --> Visual Studio 2003/2005 Command Prompt
*
*       o If the .NET SDK is installed
*           From the Start Menu: click Start --> Programs
*           -->Microsoft .NET Framework SDK v2.0 -->SDK Command Prompt
*
*       Once the .NET Command Prompt is open run the following command to
*       open a DB2 Command Prompt:
*         db2cmd
*
*       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 'nmake' command in your working directory:
*
*       o nmake <program name> - builds the sample identified by
*                                <program name> Do not include the file
*                                extension for the program name.  E.g. nmake
*                                DbAuth For any dependencies refer to the
*                                individual sample.
*       o nmake srv            - builds only samples that can be run on the
*                                server, including routines (stored
*                                procedures and User Defined Functions).
*       o nmake rtn            - builds only routines.
*       o nmake call_rtn       - builds only client programs that call
*                                routines.
*       o nmake client_run     - builds only programs that run completely on
*                                the client (not ones that call routines).
*       o nmake all_client     - builds all client samples (all programs in
*                                the 'call_rtn' and 'client_run' categories).
*       o nmake all            - builds all supplied sample programs
*
*****************************************************************************
*
*                 *** BUILDING SAMPLES USING BUILD FILES ***
*
*   As an alternative to the makefile, the build files included with the DB2
*   samples can be used to build the VB .NET programs.
*
*    Building any XML Samples:
*
*          o bldXMLapp <prog_name>
*                      <prog_name> - the name of the sample program
*                                    without the .vb extension.
*          For any additional dependencies refer to the individual sample.
*
*   Building Standalone Samples:
*
*          o bldapp <prog_name>
*                   <prog_name> - the name of the sample program without the
*                                 .vb extension.
*          For any additional dependencies refer to the individual sample.
*
*   Building and Executing Stored Procedures:
*
*         o Build stored procedure server and copy the resulting .class file
*           to the <install path>sqllib\function directory with the
*           following command:
*           bldrtn <prog_name>
*                  <prog_name>  - Name of the sample program without the
*                                 .java extension.
*
*         o Catalog stored procedures with the following command:
*           SpCat.bat
*
*         o Build stored procedure client with the following command:
*           bldapp <prog_name>
*                  <prog_name>  - Name of the sample program without the
*                                 .vb extension.
*
*   Building and Executing User Defined Functions:
*
*        o Build UDF server and copy the resulting .class file to the
*          <install path>sqllib\function directory with the
*          following command:
*          bldrtn <prog_name>
*                 <prog_name>   - the name of the sample program without the
*                                 .vb extension.
*
*        o Catalog User Defined Functions with the following command:
*          UDFCat.bat
*
*        o Build UDF client with the following command:
*          bldapp <prog_name>
*                 <prog_name>   - Name of the sample program without the
*                                 .vb extension.
*
*****************************************************************************
*
*              Common file Descriptions
* 
* The following are the common files for VB .NET samples. For more
* information on these files, refer to the program source files.
*
******************************************************************************
*
* Common files
*
* README        - this file
*
* makefile      - makefile for all files
*
* XML_Util.vb
*
*****************************************************************************
*
* Batch files
*
* bldXMLapp.bat - Builds a VB .NET program.
*
* bldapp.bat    - Builds a VB .NET program.
*
* bldrtn.bat    - Builds the stored procedures in SpServer.vb and copies the
*                 resulting assembly SpServer.dll file to the
*                 <install path>sqllib\function directory.
*
* SpCat.bat     - Catalogs the stored procedures in SpServer.vb (located in
*                 the samples\.NET\vb\ directory).
*
* UDFCat.bat    - Catalogs the user-defined functions (UDFs) in UDFsrv.vb
*                 (located in the samples\.NET\v directory).
*
* empcat.bat    - Catalogs the stored procedure EMP_DETAILS (in
*                 EmpDetails.db2).
*
* regCOM.bat    - Registers COM+ objects for the LCTrans program.
*
* regCOM.bat    - Registers COM+ objects for the LCTrans program.
*
* XmlSpCat.bat                - Batch file that first calls
*                               XmlSimpleProcDrop.db2 and then calls
*                               XmlSimpleProcCreate.db2. This file
*                               will be found only for windows platforms.
*
* XmlSpCatXQuery.bat          - Batch file that first calls
*                               XmlXQueryProcDrop.db2 and then calls
*                               XmlXQueryProcCreate.db2. This file
*                               will be found only for windows platforms.
*
*****************************************************************************
*
*                         VB .NET Samples Design
*
* The VB .NET 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
*
*     Db        Database Level
*     Tb        Table Level
*     Dt        Data Type Level
*     Sp        Stored Procedure Level
*     UDF       User-defined function Level
*     Xml       XML Database Samples
*
*****************************************************************************
*
*                        VB .NET Sample Descriptions
*
* The following are the VB .NET sample files included with DB2. For more
* information on the sample programs, refer to the program source files.
*
*****************************************************************************
*
* Database Level
*
* DbAuth.vb      - How to grant/display/revoke authorities at database level.
*
* DbDatAdp.vb    - How to use a DB2DataAdapter.
*
* DbDatMap.vb    - How to set up DataTable and DataColumn mappings.
*
* DbDsetCn.vb    - How to add exisiting contraints to a DataSet.
*
* DbEvent.vb     - How to handle DB2DataAdapter events.
*
* DbUse.vb       - How to work with database objects.
*
* DbValue.vb     - How to obtain a single value from a database.
*
*****************************************************************************
*
* Table Level
*
* TbConstr.vb     - How to work with table constraints.
*
* TbInfo.vb       - How to get and set information at a table level.
*
* TbPriv.vb       - How to grant/display/revoke privileges at a table level.
*
* TbSel.vb        - How to select from each of: insert, update, delete.
*
* TbTrig.vb       - How to use a trigger on a table.
*
* TbUse.vb        - How to manipulate table data and connect to/disconnect
*                   from a database.
*
*****************************************************************************
*
* Data Type Level
*
* DtLob.vb       - How to use the LOB data type.
*
*****************************************************************************
*
* Stored Procedure Level
*
* SpCat          - A batch file that runs SpDrop.db2 and SpCreate.db2 scripts
*                  to drop and recreate the Visual Basic (VB) stored
*                  procedures.
*
* SpDrop.db2     - DB2 command line processor (CLP) script that drops the
*                  sample VB stored procedures from the DB2 database.
*
* SpCreate.db2   - DB2 CLP script that executes the CREATE PROCEDURE
*                  statements for the VB stored procedures implemented in
*                  SpServer.vb.
*
* SpServer.vb    - VB stored procedure implementations called by client
*                  application SpClient.vb
*
* EmpDetails.db2 - DB2 CLP script that creates an SQL stored procedure
*                  named EMP_DETAILS
*
* SpReturn.vb    - Client application that calls the SQL stored procedure
*                  EMP_DETAILS, in file EmpDetails.db2, and obtains its
*                  return value.
*
* SpClient.vb    - Client application that calls the variety of different
*                  Visual Basic stored procedures implemented in SpServer.vb
*
*****************************************************************************
*
* User-defined Function (UDF) Level
*
* UDFCat          - A batch file that runs UDFDrop.db2 and UDFCreate.db2
*                   scripts to drop and recreate the Visual Basic UDFs.
*
* UDFDrop.db2     - DB2 command line processor (CLP) script that drops the
*                   sample Visual Basic UDFs from the DB2 database.
*
* UDFCreate.db2   - DB2 CLP script that executes the CREATE FUNCTION
*                   statements for the Visual Basic UDFs implemented in
*                   UDFsrv.vb.
*
* UDFsrv.vb       - Visual Basic UDF implementations called by client
*                   application UDFcli.vb
*
* UDFcli.vb       - Client application that calls the variety of different
*                   Visual Basic UDFs implemented in SpServer.vb
*
*****************************************************************************
*
* Loosely Coupled Transactions
*
* LCTrans.vb     - Demonstrates loosely coupled transactions
*
* RootCOM.vb     - This file is used to create a library assembly
*                  RootCOM.dll. LCTrans.vb refers to the classes and
*                  methods that are defined in this file.
*
* SubCOM.vb      - This file is used to create a library assembly
*                  SubCOM.dll. LCTrans.vb refers to the classes and
*                  methods that are defined in this file.
*
*****************************************************************************
*
* XML Database Samples
*
* XmlIndex.vb                    - Create an index and use it in an XQuery
*
* XmlUniqueIndexes.vb            - Create and index with UNIQUE and VARCHAR 
*                                  length constraints 
*                         NOTE : This sample demonstrate the how to enforce the
*                         constraints on an XML value. There are some statement
*                         in the samples which are expected to fail because of
*                         constraint violation so The sql error SQL803N,
*                         SQL20305N and SQL20306N are expected.
*
* XmlInsert.vb                   - Insert an XML document into a column of 
*                                  XML data type
*                         PREREQUISITE : copy the file cust1023.xml to the
*                         working directory before running the sample. The
*                         file can be found in the
*                         <install_path>\sqllib/samples/xml/data directory.
*
* XmlUpAndDel.vb                 - Update and delete XML documents in the 
*                                  tables
*                         PREREQUISITE : copy the files cust1023.xml,
*                         cust1022.xml and cust1023.xml to the working directory
*                         before running the sample. The file can be found in
*                         the <install_path>\sqllib/samples/xml/data directory.
*
* XmlRead.vb                     - Read XML data stored in tables
*
* XmlRelToXmlDOC.vb              - Create and XML document directly from data
*                                  stored in relational tables using SQL/XML 
*                                  publishing sunctions
*                         PREREQUISITE: This sample uses a stored procedure.
*                         Stored procedure should be registered before running
*                         the sample. Follow the step given in the header of
*                         the sample for more details. Run the cleanup.db2
*                         and setupscript.db2 scripts before running this
*                         simple.Run the cleanupscript.db2 script to cleanup
*                         the database objects after running the sample.
*                         These scripts can be found in
*                         <install_path>\sqllib/samples/xml/data directory.
*
* XmltoTable.vb                  - Insert the data from an XML document into
*                                  relational tables using SQL/XML
*                         PREREQUISITE: copy purchaseorder.xml XML document
*                         from <install_path>\sqllib/samples/xml/data
*                         directory to the working directory.
*
* XmlRelToXmlType.vb             - Create an XML document from relational and 
*                                  XML data using SQL/XML publishing functions
*                         PREREQUISITE: Run the script setupscript.db2 before
*                         running this simple. Run the cleanupscript.db2 script
*                         to cleanup the database objects after running the
*                         sample. These scripts can be found in
*                         <install_path>\sqllib/samples/xml/data directory.
*
* XmlDecomposition.vb            - Decompose data stored in an XML file and 
*                                  insert the data into tables
*                         PREREQUISITE:run the script setupfordecomposition.db2
*                         before running the sample. Run the script
*                         cleanupfordecomposition.db2 after running the sample
*                         to cleanup the object created for the samples. These
*                         scripts can be found in xml/data directory. This
*                         sample require bookdetail.xml, bookdetail.xsd files
*                         at run time. Copy these files to your working
*                         directory before running the sample. These file can
*                         be found in <install_path>\sqllib/samples/xml/data
*                         directory.
*
* XmlSchemas.vb                  - Register the XML schema to the database 
*                                  and use the registered schema to validate 
*                                  and insert and XML document
*                         PREREQUISITE: copy product.xsd, order.xsd,
*                         customer.xsd, header.xsd Schema files, order.xml XML
*                         document from <install_path>\sqllib/samples/xml/data
*                         directory to working directory.
*
* XmlFlwor.vb                    - Use the XQuery FLWOR expression
*
* XmlSQLXQuery.vb                - Use SQL/XML queries
*
* XmlXPath.vb                    - Run simple XPath queries
*
* XmlXQuery.vb                   - Executing nested XQuery FLWOR expression
*
*******************************************************************************
*
* XML Stored Procedure Samples
*
* XmlSimpleProcClient.vb      - Client application that calls the stored
*                               procedure.
*                               PREREQUISITE: build the server
*                              "XmlSimple_Proc.vb"and register the procedure
*                               using XmlSpCat.
*
* XmlSimple_Proc.vb           - Stored procedure functions built and run on the
*                               server.
*
* XmlSimpleProcCreate.db2     - CLP script to issue CREATE PROCEDURE statement.
*
* XmlSimpleProcDrop.db2       - CLP script to drop stored procedure from the
*                               catalog.
*
* XmlXQueryProcClient.vb      - Client application that calls the stored
*                               procedure.
*                               PREREQUISITE: build the server
*                              "XmlXQueryProc.vb"and register the procedure
*                               using XmlSpCatXQuery.
*
* XmlXQueryProc.vb            - Stored procedure functions built and run on the
*                               server.
*
* XmlXQueryspcat.bat          - Batch file that first calls
*                               XmlXQueryProcDrop.db2 and then calls
*                               XmlXQueryProcCreate.db2. This file
*                               will be found only for windows platforms.
*
* XmlXQueryProcCreate.db2     - CLP script to issue CREATE PROCEDURE statement.
*
* XmlXQueryProcDrop.db2       - CLP script to drop stored procedure from the
*                               catalog.
*
*******************************************************************************