Testing the CLI database connectivity with the db2dsdriver.cfg file
You can test the CLI database connectivity with the db2dsdriver.cfg file to ensure that the db2dsdriver.cfg file is valid and the CLI driver is installed correctly.
Before you begin
You must ensure that the CLI driver is installed and the db2dsdriver.cfg file is created in your environment with a required data source name (DSN) entry. You can use the contents of the db2dsdriver.cfg.sample file to create the db2dsdriver.cfg file.
If you are using the lightweight directory access protocol (LDAP) to access the DSN entry, the db2dsdriver.cfg file must have the <ldapserver> section configured.
Procedure
To test the CLI connectivity with the db2dsdriver.cfg file:
Issue the db2cli validate -dsn <dsn_name> -connect
-user <username> -passwd <password> command. The <dsn_name> is
the DSN in the db2dsdriver.cfg file that you
are testing the connection to. The <username> is
the valid user ID that is used to connect to the target data source.
The <password> is the valid password that is
associated with the specified user ID.
Results
Example
The following sample <ldapserver> section
entry of the db2dsdriver.cfg file is used to
connect to the sampleldaphost server to obtain
the DSN entry:
<configuration>
<ldapserver>
<parameter name="EnableLDAP" value="YES"/>
<parameter name="LDAPServerHost" value="sampleldaphost.ibm.com"/>
<parameter name="LDAPServerPort" value="389"/>
<parameter name="UserID" value="cn=root"/>
<parameter name="Password" value="password"/>
<parameter name="BaseDN" value="O=IBM"/>
</ldapserver>
</configuration>
The following command output
shows a successful connection to the sampledsn DSN
entry in the db2dsdriver.cfg file:
$ db2cli validate -dsn sampledsn –connect
...
Connection Section :
------------------------------------------------------------------
Connecting to: sampledsn
Connect Status: success
End Connection Section
------------------------------------------------------------------
The validation completed.