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 to connect to our local database. This and other needed classes are found in, 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',
          '')$" />
      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:
  • The syntax of the table name in the SQL query is different. For Excel:
    For DB2:
  • As mentioned before, we are using a different driver to connect to the database.
  • This time we needed to use EditDB's setUserID and setPassword methods to specify the appropriate ID and Password to connect to the database.
  • This macro does not launch the local database when you are done making your additions. You can verify that the records were properly added by performing a "Select * from CUSTRECS" query on the database.