IBM Support

Checking ODBC connectivity on Linux

Question & Answer


Question

How do you check ODBC connectivity via unixODBC driver on a Linux system?

Answer

To check connectivity:

1. Check that the ODBC Driver Manager is installed by running the following command:

    $ rpm -qa | grep -i odbc

If you see the unixODBC entry, the ODBC Driver Manager is installed.
  • unixODBC-2.2.11-1.RHEL4.1
  • unixODBC-kde-2.2.11-1.RHEL4.1

2. You can check the connectivity of the ODBC settings by running the following command, which accesses the database using a command in the unixODBC package:
    $ isql <DSN> <user name> <password>

If the SQL> prompt appears, you successfully set up the ODBC connection with the database.

For example, if your DSN is defined in the /etc/odbc.ini file as follows:
    [NZSQL]

    Database = SYSTEM

    Username = Admin

    Password = password

Then the isql command line should be as follows:
    $ isql NZSQL Admin password

To learn more about how to set up ODBC on a Linux system, refer to the ODBC_README file. The file is included with the cli.package.tar.z file.

[{"Product":{"code":"SSULQD","label":"IBM PureData System"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":null,"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"1.0.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
17 October 2019

UID

swg21575431