Thu, 21 Feb 2019
Changing How isql Executes SQL
isql is typically used as a troubleshooting tool. For example, if you are having an issue with your ODBC back end, isql will help you identify whether the problem lies with your application (i.e. do you stil get the same problem in isql as you get in your application) or elsewhere.
-e flag enables you to change how isql executes SQL. Doing this enables you to simulate how your application behaves in this regard.
To find out which method your application uses to execute SQL:
- Add these lines to /etc/odbcinst.ini:
[ODBC] Trace=Yes TraceFile=/tmp/sql.log
- Run a query in you application.
- Open /tmp/sql.log in a text editor. If the log file contains "SQLPrepare", your application uses this ODBC API. Otherwise it uses
/etc/odbcinst.ini, turn off ODBC tracing:
[ODBC] Trace=No TraceFile=/tmp/sql.log
By default, isql uses
SQLExecute to execute SQL statements.
SQLExecDirect instead, include the
-e flag on the command line:
/usr/local/easysoft/unixODBC/bin/isql.sh -e -v SQLSERVER_SAMPLE SQL> select mycol from mytable