Steps for running DB2 sample

If you are using an IBM plug-in and do not have the sun.jdbc.odbc package in your classpath, you can instead run this sample with IBM DB2.

  1. Create a DB2 database. Call the database "AMNU" and create a table "CUSTRECS" with columns "NAME", "ADDRESS", "PHONE", "DATE", "AMOUNT" and "COMMENT".
  2. Put appropriate DB2 drivers in your classpath. Rather than using sun.jdbc.odbc.JdbcOdbcDriver, we will now use COM.ibm.db2.jdbc.net.DB2Driver to connect to our local database. This and other needed classes are found in db2java.zip, which was likely placed in \SQLLIB\java when you installed DB2. There are different ways of getting these needed files in your classpath, depending on your setup.
  3. Edit the macro for your DB2 database.
    1. In the line:
      <create name="$database$" type="DB" 
           value="$new DB('jdbc:db2://hostname:6789/AMNU',
          'COM.ibm.db2.jdbc.net.DB2Driver')$" />
      change hostname to the name of your machine running DB2.
    2. Find the following two perform actions:
      <perform value="$database.setUserID('db2admin')$"  />
      <perform value="$database.setPassword('db2admin')$"  />
      and modify them with and ID and Password that will connect to your DB2 database.
  4. Follow steps 3-7 above, this time importing AMNUDB2.mac.
Note some differences in the two macros: