Validating ODBC connectivity (UNIX and Linux®)

After configuring the data source, validate connectivity.

About this task

To validate that you can use ODBC to connect to a system data source if you are using the unixODBC driver manager, use the isql interactive SQL query program. The isql program is installed on your system when you install the unixODBC driver manager. You can use the isql program to run SQL queries against both the system data source and any user data sources that you configure. For the procedure in this topic, it is assumed that you are using the unixODBC driver manager.

If you are using a driver manager other than unixODBC, consult your Netezza Performance Server system administrator to see whether there is an SQL query program that is installed on your client system that you can use instead of the isql program to validate ODBC connectivity and query Netezza Performance Server system data sources. The following example uses the DataDirect driver manager. The example program in the example directory is run, and the data source name, user name, and password are entered as shown:
./example 
      DataDirect Technologies, Inc. ODBC Example Application.
   Enter the data source name : NZSQL
   Enter the user name        : admin
   Enter the password         : password
   Enter SQL statements (Press ENTER to QUIT)
SQL>
Note: Do not use double quotation marks or semicolons in the password.

Procedure

  1. Change to the directory that contains the isql interactive SQL application by issuing the following command:
    cd /usr/local/unixODBC/bin
  2. Start the isql application and connect to the NZSQL system data source by issuing the following command:
    isql -v NZSQL
    If your connection is successful, you see a response similar to the following one:
    +---------------------------------------+
    | Connected!                            |
    |                                       |
    | sql-statement                         |
    | help [tablename]                      |
    | quit                                  |
    +---------------------------------------+
    
  3. Query the _t_dslice table in the system database in the NZSQL data source by issuing the following command:
    select * from _t_dslice
    If your ODBC driver is correctly installed and your system data source is correctly configured, the isql program displays the contents of the _t_dslice table. You see a response that is similar to the following one:
    +------------+------------+------------+------------+
    | ds_id      | ds_pridskid| ds_priptid | ds_mirdskid|
    +------------+------------+------------+------------+
    | 1          | 1002       | 0          |            |
    +------------+------------+------------+------------+
  4. End the connection to the NZSQL system data source and exit the isql program by issuing the quit command.
  5. Restart the isql program and connect to a test user data source by issuing the isql command with the -v option. For example, the following command restarts the isql program and connects to the Test_User user data source:
    isql -v Test_User
    If your connection is successful, you again see a response that is similar to the following one:
    +---------------------------------------+
    | Connected!                            |
    |                                       |
    | sql-statement                         |
    | help [tablename]                      |
    | quit                                  |
    +---------------------------------------+
    
  6. Run a query against a table in the test data source. Assuming that the system database in the Test_User data source contains a table that is named a_inventory, query the a_inventory table by issuing the following command:
    select * from a_inventory
    If the ODBC driver is correctly installed and the user data source is correctly configured, the isql program displays the contents of the a_inventory table:
    +------------+----------+------------+
    | part_no    | part_name| on_hand    |
    +------------+----------+------------+
    | 181        | Wheel    | 449        |
    | 124        | Bolt     | 900        |
    | 105        | Gear     | 0          |
    | 134        | Nut      | 743        |
    +------------+----------+------------+