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.
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.
To test the CLI connectivity with the db2dsdriver.cfg file:
<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>
$ db2cli validate -dsn sampledsn –connect
...
Connection Section :
------------------------------------------------------------------
Connecting to: sampledsn
Connect Status: success
End Connection Section
------------------------------------------------------------------
The validation completed.