SQL0206N error when trying to connect HammerDB to DB2 using db2dsdriver.cfg file

488 views Asked by At

I'm trying to generate some data for DB2 10.5 LUW using HammerDB v3.1 which is running on a Windows remote host. There is no ability to run HammerDB on the same host with DB2. According to the HammerDB documentation I need to set up IBM Data Server Driver for ODBC and CLI.

What I did:

  1. Downloaded and set up the driver on HammerDB host - v10.5fp10_ntx64_odbc_cli.zip as described here

  2. Configure db2dsdriver.cfg file

<configuration>
   <dsncollection>
      <dsn alias="TPCC" name="<my database name>" host="<my host name>" port="50000"/>
      <!-- Long aliases are supported -->
      <dsn alias="longaliasname2" name="name2" host="server2.net1.com" port="55551">
         <parameter name="Authentication" value="SERVER_ENCRYPT"/>
      </dsn>
   </dsncollection>
   <databases>
      <database name="<my database name>" host="<my host name>" port="50000">
         <parameter name="CurrentSchema" value="OWNER1"/>
         .......
  1. Add environment variable DB2DSDRIVER_CFG_PATH

set DB2DSDRIVER_CFG_PATH=C:\ProgramData\IBM\DB2\C_IBMDB2_CLIDRIVER_clidriver\cfg

  1. Run HammerDB GUI, try to build a schema and receive
Error in Virtual User 1: [IBM][CLI Driver][DB2/LINUXX8664] SQL0206N  "GLOBAL_VAR1" is not valid in the context where it is used.  SQLSTATE=42703```


1

There are 1 answers

1
mao On BEST ANSWER

This error is happening because the db2dsdriver.cfg has excess information for your DSN on a Db2-client-node.

To recover, you can either rename and recreate your db2dsdriver.cfg/db2cli.ini files, or you can can edit the db2dsdriver.cfg file and remove the following stanza where it occurs for your DSN / database (take a backup as a precaution):

<sessionglobalvariables>
    <parameter name="global_var1" value="abc"/>
 </sessionglobalvariables>

I usually discard the default db2dsdriver.cfg/db2cli.ini, and use a script to populate them. This is possible by using the command line tool "db2cli", which has a variety of command lines parameters to let you write the cfg file stanzas for both DSN and databases. Documentation here.