unixODBC - isql

About

Syntax

isql DSN [UID [PWD]] [options]

where Options:

  • -b: batch.(no prompting etc)
  • -dx: delimit columns with x
  • -x0xXX delimit columns with XX, where:
    • x is in hex,
    • ie 0x09 is tab
  • -w: wrap results in an HTML table
  • -c: column names on first row (only used when -d)
  • -mn: limit column display width to n
  • -v: verbose
  • -lx: set locale to x
  • -q: wrap char fields in dquotes
  • -3: Use ODBC 3 calls
  • -n: Use new line processing
  • -e: Use SQLExecDirect not Prepare
  • -k: Use SQLDriverConnect. Treat the DSN as a connection string and use SQLDriverConnect isql -k “DSN=server;UID=test;PWD=test”
  • –version version

Commands

  • help - list tables
  • help table - list columns in table
  • help help - list all help options

Examples

Basic

isql -v WebDB MyID MyPWD
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+

Execute a query

With an extern file

isql WebDB MyID MyPWD -w < My.sql

Each line in My.sql must contain exactly 1 SQL command except for the last line which must be blank (unless -n option specified).

With a sql

Type the SQL in one line and after that the go statement.

select 1 from dummy
go
+------------+
| 1          |
+------------+
| 1          |
+------------+
SQLRowCount returns 1
1 rows fetched

Support

Verbose

isql -v WebDB MyID MyPWD
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect

ODBCINI and ODBCSYSINI variable

$ echo $ODBCINI
/u01/app/oracle/product/fmw/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup/odbc.ini

Powered by ComboStrap