DB2 10.5 for Linux, UNIX, and Windows

Testing the ODBC database connectivity with the db2dsdriver.cfg file

You can test the ODBC database connectivity with the db2dsdriver.cfg file to ensure that the db2dsdriver.cfg file is valid and the ODBC driver manager is configured 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.

You also must install the ODBC driver manager and configure it to use the DB2® ODBC driver. To install and configure the unixODBC driver manager, see Installing the unixODBC driver manager.

Procedure

To test the ODBC connectivity with the db2dsdriver.cfg file:

Issue the isql <dsn_name> command. The <dsn_name> is the DSN in the odbc.ini file (user INI file of the ODBC driver manager) and the db2dsdriver.cfg file that you are testing the connection to. The isql command is provided with the ODBC driver manager.

Results

The isql <dsn_name> command output displays the connection test status.

Example

The following command output shows a successful connection to the sampledsn DSN entry:
$ isql sampledsn
+---------------------------------------
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL>