• Topic
  • Discussion
  • UdaWikiWeb.TestingUnixODBCDSNs(Last) -- Owiki? , 2016-08-19 15:01:04 Edit owiki 2016-08-19 15:01:04

    Testing ODBC DSNs on Unix-like OS, with iODBCTest/ODBCTest

    Originally named odbctest (as found in Release 5 and earlier installations), iodbctest is a simple 'C' based, ODBC-compliant Interactive SQL processor. The binary executable of this sample application will be found in at least one of the following directories:

    <OPENLINK_INSTALLATION_DIRECTORY>/samples/ODBC/
    <OPENLINK_INSTALLATION_DIRECTORY>/bin/
    

    More recent installations should include a Unicode (sometimes called "wide") variant, iodbctestw, for use with multi-byte character sets. Note that will only work properly when supported by suitably configured login and shell sessions and terminal emulators. These configurations can be tricky to get all lined up right!

    The source code for this application (both single- and multi-byte variants) is installed as part of the iODBC SDK, and then may be found in the following directory:

    <OPENLINK_INSTALLATION_DIRECTORY>/odbcsdk/examples/
    

    Steps

    1. Set the OpenLink environment by running the appropriate script for your shell. The following will work in most environments, but your required command may differ --
      shell command Sort in descending order
      sh, bash, zsh and related . ./openlink.sh
      ksh and related source ./openlink.sh
      csh, tcsh and related source ./openlink.csh

    2. Start iODBCTest by executing the binary name as a command:


      iodbctest

    3. When prompted for a connect string, you can enter "?" to see a list of ODBC DSNs on your machine, or you can immediately enter a valid ODBC Connect String following the form --


      DSN=<dsn name>[;UID=<username>[;PWD=<password>]][;<connect string attribute>=<value>]

      For instance, if you have an Oracle DSN named "Marketing", you might enter:


      DSN=Marketing;UID=scott;PWD=tiger

      • Note: If there is a username but no password, you must include a semicolon at the end of the connect string, as:


        DSN=Marketing;UID=sa;PWD=;

    4. If you know the ODBC Connect String before starting iODBCTest, you can pass that string as an argument to the binary command. The Connect String must be wrapped in quotes, to prevent the Unix shell from processing the semicolons or other elements of that string:


      iodbctest "DSN=Marketing;UID=scott;PWD=tiger"

    5. Once connected, you can execute any valid SQL or ODBC statement. You can also call on several built-in functions, which interrogate the back-end for --
      • datatypes
      • owners
      • qualifiers
      • tables
      • types

    Referenced by...