For the tiny footprint ODBC and CLI driver
(known as clidriver) from IBM, you are responsible for creating and editing the db2dsdriver.cfg
configuration file. It is a small XML file documented here and in related linked pages. The hammerdb documentation also gives a minimal example and you linked to this page in your question.
You can create and edit this file either by command lines to the db2cli
tool, or by directly editing with a text editor (or XML editor). It may be easier to use an editor than to learn the command lines, although command lines have the advantage that they lend themselves to scripting this activity for larger installations.
On Microsoft-Windows you can also use Notepad to create and edit the file db2dsdriver.cfg
.
An important step is that following editing of the file you must first validate its contents before trying any database connections. Validation checks that the syntax of the XML in the file is correct. To validate, you use the db2cli validate
command described here. It must show a successful result before you try to connect to any database. Once validation completes without errors, you can also use db2cli validate -connect -dsn XXX -user YYY -passwd ZZZ
to test the connection independently of your application (in this case hammerdb). Once you get a successful connection with the db2cli validate -connect -dsn ...
then your application (hammerdb) will connect correctly.
There are many examples of db2dsdriver.cfg
contents online , but your first source should be the Db2 Knowledge Centre online, which details the command line options to the db2cli
command, along with giving examples of db2dsdriver.cfg
.
If you already have a working Db2 configuration with local and remote databases (but no db2dsdriver.cfg
file), you can also use a tool db2dsdcfgfill
to populate db2dsdriver.cfg
from your existing Db2 configuration. See docs here.