isql(1) | unixODBC manual pages | isql(1) |
isql, iusql - unixODBC interactive SQL command-line tools
isql DSN [USER [PASSWORD]] [options]
isql and iusql are command-line tools allowing users to execute SQL interactively or in batches.
The tools provide several useful features, including an option to generate output wrapped in an HTML table.
iusql is the same as isql but includes built-in Unicode support. Some data sources only work with iusql.
When searching the configuration files, unixODBC looks for a bare name. If the DSN begins with a semicolon, it is treated as a connection string. The connection string can contain a DSN and/or other semicolon-separated parameters.
This parameter overrides any UID specified in the data source configuration files.
This parameter overrides any PASSWORD specified in the data source configuration files.
This section briefly describes some isql and iusql run-time commands.
help
help table
help help
$ iusql WebDB MyID MyPWD -w -b < My.sql
Connects to the WebDB DSN as user MyID with password MyPWD, then executes the commands in the My.sql file and returns the results wrapped in an HTML table.
Each line in My.sql must only contain one SQL command, except for the last line, which must be blank (unless the -n option is specified).
Note the leading semicolon on the connection string.
$ iusql ";DSN=WebDB" MyID MyPWD -w -b < My.sql
Options in the DSN may be overridden in the connection string:
$ iusql ";DSN=WebDB;Driver=PostgreSQL ODBC;UID=MyID;PASSWORD=secret;Debug=1;CommLog=1" -v
A string DSN may be provided in its entirety, with no file DSN reference at all:
$ iusql ";Driver=PostgreSQL Unicode;UID=MyID;PASSWORD=secret" -v
Re-run isql or iusql with the -v flag to get more information from errors, and/or enable Trace mode in odbcinst.ini.
Check that the driver name specified by the Driver entry in the odbc.ini data-source definition is present in odbcinst.ini and exactly matches the odbcinst.ini [section name].
If the ODBC driver is properly specified for the data source, it is possible that the driver is not loadable. Check for mix-ups between Unicode and ANSI drivers, and verify the driver paths in the odbcinst.ini [section name].
Some data sources are Unicode-only and require the use of iusql. If isql reports
but the data source and driver required are listed by
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect
and
odbcinst -q -d
then try iusql.
odbcinst -q -s
/etc/odbc.ini
$HOME/.odbc.ini
unixODBC(7), odbcinst(1), odbc.ini(5)
"The unixODBC Administrator Manual (HTML)"
The authors of unixODBC are Peter Harvey <pharvey@codebydesign.com> and Nick Gorham <nick@lurcher.org>.
For a full list of contributors, refer to the AUTHORS file.
unixODBC is licensed under the GNU Lesser General Public License. For details about the license, see the COPYING file.
Thu 14 Jan 2021 | version 2.3.11 |