1
2isql(1)                      UnixODBC manual pages                     isql(1)
3
4
5

NAME

7       isql, iusql - unixODBC command-line interactive SQL tool
8
9

SYNOPSIS

11       isql DSN [USER [PASSWORD]] [options]
12
13

DESCRIPTION

15       isql  is  a  command  line tool which allows the user to execute SQL in
16       batch or interactively. It has some  interesting  options  such  as  an
17       option to generate output wrapped in an HTML table.
18
19       iusql  is the same tool with built-in Unicode support. Some datasources
20       only work with iusql.
21
22

ARGUMENTS

24       DSN    The Data Source Name, which should be used to make connection to
25              the   database.    The   data   source  is  looked  for  in  the
26              /etc/odbc.ini and $HOME/.odbc.ini files in that order, with  the
27              latter overwriting the former.
28
29              A  bare  name  is  looked up in the above files. If the DSN name
30              begins with a semicolon then it's treated as a connection string
31              instead.  The  connection  string  may contain a DSN name and/or
32              other semicolon-separated parameters.
33
34
35       USER   Specifies the database  user/role  under  which  the  connection
36              should be made.
37
38              Overrides any UID specified in the DSN.
39
40
41       PASSWORD
42              Password for the specified USER.
43
44              Overrides any Password specified in the DSN.
45
46

OPTIONS

48       -b     Run  isql  in non-interactive batch mode. In this mode, the isql
49              processes its standard input,  expecting  one  SQL  command  per
50              line.
51
52
53       -dDELIMITER
54              Delimits columns with delimiter.
55
56
57       -xHEX  Delimits  columns  with  HEX, which is a hexadecimal code of the
58              delimiting character in the format 0xNN - i.e. 0x09 for the  TAB
59              character.
60
61
62       -w     Format the result as HTML table.
63
64
65       -c     Output the names of the columns on the first row. Has any effect
66              only with the -d or -x options.
67
68
69       -mNUM  Limit the column display width to NUM characters.
70
71
72       -lLOCALE
73              Sets locale to LOCALE.
74
75
76       -q     Wrap the character fields in double quotes.
77
78
79       -3     Use the ODBC 3 calls.
80
81
82       -n     Use the new line processing. (multiple lines of SQL,  terminated
83              with command GO).
84
85
86       -e     Use the SQLExecDirect instead of Prepare.
87
88
89       -k     Use SQLDriverConnect.
90
91
92       -v     Turn  on the verbose mode, where the errors are fully described.
93              Useful for debugging.
94
95
96       --version
97              Prints the program version and exits.
98
99
100       -LNUM  Alter the maximum number of characters displayed from a  charac‐
101              ter field to NUM characters. Default is 300.
102
103

COMMANDS

105       This section briefly describes some isql runtime commands.
106
107       help
108              List all tables in the database.
109
110       help table
111              List all columns in the table.
112
113       help help
114              List all help options.
115
116

EXAMPLES

118       A bare DSN name:
119
120              $ iusql WebDB MyID MyPWD -w -b < My.sql
121
122              Connects  to  the  WebDB  as user MyID with password MyPWD, then
123              execute the commands in the My.sql file and returns the  results
124              wrapped in HTML table.  Each line in My.sql must contain exactly
125              1 SQL command, except for the last line,  which  must  be  blank
126              (unless the -n option is specified).
127
128
129       A DSN name in a connection string:
130
131              Note the leading semicolon on the connection string:
132
133              $ iusql ";DSN=WebDB" MyID MyPWD -w -b < My.sql
134
135              Options in the DSN may be overridden in the connection string:
136
137              $ iusql ";DSN=WebDB;Driver=PostgreSQL ODBC;UID=MyID;PASSWORD=secret;Debug=1;CommLog=1" -v
138
139
140       A string DSN:
141
142              A  string  DSN may be provided in its entirety, with no file DSN
143              reference at all:
144
145              $ iusql ";Driver=PostgreSQL Unicode;UID=MyID;PASSWORD=secret" -v
146
147

TROUBLESHOOTING

149       Cryptic error messages
150
151              Re-run iusql or isql with the -v flag to get  more  detail  from
152              errors, and/or enable Trace mode in odbcinst.ini.
153
154
155       Missing driver definition
156
157              Check that the driver name specified by the Driver entry in  the
158              odbc.ini data-source definition is present in  odbcinst.ini  and
159              exactly matches the odbcinst [section name].
160
161
162       Unloadable or incompatible driver
163
164              If the driver is properly specified for the datasource it's pos‐
165              sible that the driver may not  be  loadable.  Check  for  mixups
166              between Unicode and ANSI drivers. Verify the driver paths in the
167              odbcinst.ini section name.
168
169
170       Unicode datasources with ANSI clients
171
172              Some datasources are Unicode-only and only work with  iusql.  If
173              isql reports
174                [IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
175                [ISQL]ERROR: Could not SQLConnect
176              but the datasource is listed by
177                odbcinst -q -d
178              and the driver it uses is listed by
179                odbcinst -q -d
180              then try iusql.
181
182

FILES

184       /etc/odbc.ini
185              System-wide DSN definitions. See odbc.ini(5) for details.
186
187       $HOME/.odbc.ini
188              User-specific DSN definitions. See odbc.ini(5) for details.
189
190

SEE ALSO

192       unixODBC(7), odbcinst(1), odbc.ini(5)
193
194       The unixODBC Administrator Manual (HTML)
195
196

AUTHORS

198       The authors of unixODBC are Peter Harvey <pharvey@codebydesign.com> and
199       Nick Gorham <nick@lurcher.org>. For the full list of  contributors  see
200       the AUTHORS file.
201
202
204       unixODBC  is  licensed under the GNU Lesser General Public License. For
205       details about the license, see the COPYING file.
206
207
208
209version 2.3.6                   Tue 25 Jun 2013                        isql(1)
Impressum