1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247
|
.TH isql 1 "Thu 14 Jan 2021" "version 2.3.12" "unixODBC manual pages"
.SH NAME
isql, iusql - unixODBC interactive SQL command-line tools
.SH SYNOPSIS
\fBisql\fR \fIDSN\fR [\fIUSER\fR [\fIPASSWORD\fR]] [\fIoptions\fR]
\fBiusql\fR \fIDSN\fR [\fIUSER\fR [\fIPASSWORD\fR]] [\fIoptions\fR]
\fBiusql\fR \fI"ConnectionString"\fR [\fIoptions\fR]
.SH DESCRIPTION
\fBisql\fR and \fBiusql\fR 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.
\fBiusql\fR is the same as \fBisql\fR but includes built-in Unicode support.
Some data sources only work with \fBiusql\fR. An important difference between the
two tools is that \fBisql\fR connects using SQLConnect and \fBiusql\fR connects
using SQLDriverConnect.
.SH ARGUMENTS
.IP \fBDSN\fR
The Data Source Name (DSN) used to connect to the SQL database. unixODBC looks
for the specified DSN in /etc/odbc.ini and $HOME/.odbc.ini, with the latter
taking precedence.
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.
.IP \fBUSER\fR
Specifies the database user or role under which the connection should be made.
This parameter overrides any \fBUID\fR specified in the data source
configuration files.
.IP \fBPASSWORD\fR
Password required to access the database for the specified \fBUSER\fR.
This parameter overrides any \fBPASSWORD\fR specified in the data source
configuration files.
When using \fBiusql\fR, passwords containing semicolons should be escaped with
braces (curly brackets) and terminated with a semicolon. Refer to the Examples
section below for syntax.
.IP \fB"ConnectionString"\fR
A connection string starting with DSN=, DRIVER= or FILEDSN= will be passed
unchanged to SQLDriverConnect. This option allows for the use of more complex
syntax in a connection string than would otherwise be possible by just using
DSN, UID and PWD.
It also (and this was the main reason for its inclusion) allows passwords
to contain semicolons without having to add complex escape syntax to the
existing code.
.SH OPTIONS
.IP \fB\-b\fR
Run 'isql' in non-interactive batch mode. In this mode, 'isql' processes from
standard input, expecting one SQL command per line.
.IP \fB\-d\fIDELIMITER\fR
Delimit columns with the specified \fIdelimiter\fR.
.IP \fB\-x\fIHEX\fR
Delimit columns with the character represented in hexadecimal by \fIHEX\fR. The
hexadecimal code must be in the format 0xNN (e.g. 0x09 for the TAB character).
.IP \fB\-w\fR
Format the result as an HTML table.
.IP \fB\-c\fR
Output the names of the columns on the first row. This option can only be used
with the \fB\-d\fR or \fB\-x\fR options.
.IP \fB\-m\fINUM\fR
Limit the column display width to \fINUM\fR characters.
.IP \fB\-l\fILOCALE\fR
Set the character locale to \fILOCALE\fR.
.IP \fB\-q\fR
Wrap the character fields in double quotes.
.IP \fB\-3\fR
Use calls from ODBC version 3.
.IP \fB\-n\fR
Process multiple lines of SQL, terminated with the GO command.
.IP \fB\-e\fR
Use SQLExecDirect instead of Prepare.
.IP \fB\-k\fR
Use SQLDriverConnect.
.IP \fB\-v\fR
Enable verbose mode, fully describing all errors. This option is useful for debugging.
.IP \fB\-\-version\fR
Display the program version.
.IP \fB\-L\fINUM\fR
Set the maximum number of characters displayed from a character field to \fINUM\fR.
The default value is 300 characters.
.SH COMMANDS
This section briefly describes some \fBisql\fR and \fBiusql\fR run-time commands.
.B help
.RS
List all tables in the database.
.RE
.B help \fItable\fR
.RS
List all columns in the \fItable\fR.
.RE
.B help help
.RS
List all help options.
.RE
.SH EXAMPLES
.IP "A bare DSN:"
.nf
$ iusql WebDB MyID MyPWD \-w \-b < My.sql
.fi
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 \fB\-n\fR option is specified).
.IP "A DSN in a connection string:"
Note the leading semicolon on the connection string.
.nf
$ iusql ";DSN=WebDB" MyID MyPWD \-w \-b < My.sql
.fi
Options in the DSN may be overridden in the connection string:
.nf
$ iusql ";DSN=WebDB;Driver=PostgreSQL ODBC;UID=MyID;PASSWORD=secret;Debug=1;CommLog=1" \-v
.fi
.IP "A string DSN:"
A string DSN may be provided in its entirety, with no file DSN reference at all:
.nf
$ iusql ";Driver=PostgreSQL Unicode;UID=MyID;PASSWORD=secret" \-v
.fi
.IP "A password containing a semicolon (\fBiusql\fR):"
.nf
$ iusql WebDB MyID '{My;PWD};'
.fi
.nf
$ iusql 'DSN=WebDB;UID=MyID;PWD={My;PWD};'
.fi
.SH TROUBLESHOOTING
.IP "Cryptic error messages"
Re-run \fBisql\fR or \fBiusql\fR with the \fB\-v\fR flag to get more information
from errors, and/or enable \fBTrace\fR mode in \fBodbcinst.ini\fR.
.IP "Missing driver definition"
Check that the driver name specified by the \fBDriver\fR entry in the
\fBodbc.ini\fR data-source definition is present in \fBodbcinst.ini\fR and
exactly matches the odbcinst.ini \fI[section name]\fR.
.IP "Unloadable or incompatible driver"
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 \fI[section name]\fR.
.IP "Unicode data sources with ANSI clients"
Some data sources are Unicode-only and require the use of \fBiusql\fR.
If \fBisql\fR reports
.nf
[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
[ISQL]ERROR: Could not SQLConnect
.fi
but the data source and driver required are listed by
.nf
odbcinst \-q \-d
.fi
and
.nf
odbcinst \-q \-s
.fi
then try \fBiusql\fR.
.SH FILES
.I /etc/odbc.ini
.RS
Configuration file containing system-wide Data Source Name (DSN)
definitions. See
.BR odbc.ini (5)
for more information.
.RE
.I $HOME/.odbc.ini
.RS
Configuration file containing user-specific Data Source Name (DSN)
definitions. See
.BR odbc.ini (5)
for more information.
.RE
.SH SEE ALSO
.BR unixODBC (7),
.BR odbcinst (1),
.BR odbc.ini (5)
"The \fIunixODBC\fB Administrator Manual (HTML)\fR"
.SH AUTHORS
The authors of unixODBC are Peter Harvey <\fIpharvey@codebydesign.com\fR> and
Nick Gorham <\fInick@lurcher.org\fR>.
For a full list of contributors, refer to the \fIAUTHORS\fR file.
.SH COPYRIGHT
unixODBC is licensed under the GNU Lesser General Public License. For details
about the license, see the \fICOPYING\fR file.
|