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 (do you still get the same problem in isql as you get in your application?) or elsewhere.
isql's -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 your application.
- Open
/tmp/sql.log
in a text editor. If the log file containsSQLPrepare
your application uses this ODBC API. Otherwise, it usesSQLExecDirect
. - In
/etc/odbcinst.ini
, turn off ODBC tracing:[ODBC] Trace=No TraceFile=/tmp/sql.log
By default, isql uses SQLPrepare
and SQLExecute
to execute SQL statements.
To use 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