1isql(1) unixODBC manual pages isql(1)
2
3
4
6 isql, iusql - unixODBC interactive SQL command-line tools
7
8
10 isql DSN [USER [PASSWORD]] [options]
11
12
14 isql and iusql are command-line tools allowing users to execute SQL in‐
15 teractively or in batches.
16
17 The tools provide several useful features, including an option to gen‐
18 erate output wrapped in an HTML table.
19
20 iusql is the same as isql but includes built-in Unicode support. Some
21 data sources only work with iusql.
22
23
25 DSN The Data Source Name (DSN) used to connect to the SQL database.
26 unixODBC looks for the specified DSN in /etc/odbc.ini and
27 $HOME/.odbc.ini, with the latter taking precedence.
28
29 When searching the configuration files, unixODBC looks for a
30 bare name. If the DSN begins with a semicolon, it is treated as
31 a connection string. The connection string can contain a DSN
32 and/or other semicolon-separated parameters.
33
34
35 USER Specifies the database user or role under which the connection
36 should be made.
37
38 This parameter overrides any UID specified in the data source
39 configuration files.
40
41
42 PASSWORD
43 Password required to access the database for the specified USER.
44
45 This parameter overrides any PASSWORD specified in the data
46 source configuration files.
47
48
50 -b Run 'isql' in non-interactive batch mode. In this mode, 'isql'
51 processes from standard input, expecting one SQL command per
52 line.
53
54
55 -dDELIMITER
56 Delimit columns with the specified delimiter.
57
58
59 -xHEX Delimit columns with the character represented in hexadecimal by
60 HEX. The hexadecimal code must be in the format 0xNN (e.g. 0x09
61 for the TAB character).
62
63
64 -w Format the result as an HTML table.
65
66
67 -c Output the names of the columns on the first row. This option
68 can only be used with the -d or -x options.
69
70
71 -mNUM Limit the column display width to NUM characters.
72
73
74 -lLOCALE
75 Set the character locale to LOCALE.
76
77
78 -q Wrap the character fields in double quotes.
79
80
81 -3 Use calls from ODBC version 3.
82
83
84 -n Process multiple lines of SQL, terminated with the GO command.
85
86
87 -e Use SQLExecDirect instead of Prepare.
88
89
90 -k Use SQLDriverConnect.
91
92
93 -v Enable verbose mode, fully describing all errors. This option is
94 useful for debugging.
95
96
97 --version
98 Display the program version.
99
100
101 -LNUM Set the maximum number of characters displayed from a character
102 field to NUM. The default value is 300 characters.
103
104
106 This section briefly describes some isql and iusql run-time commands.
107
108 help
109 List all tables in the database.
110
111 help table
112 List all columns in the table.
113
114 help help
115 List all help options.
116
117
119 A bare DSN:
120
121 $ iusql WebDB MyID MyPWD -w -b < My.sql
122
123 Connects to the WebDB DSN as user MyID with password MyPWD, then
124 executes the commands in the My.sql file and returns the results
125 wrapped in an HTML table.
126
127 Each line in My.sql must only contain one SQL command, except
128 for the last line, which must be blank (unless the -n option is
129 specified).
130
131
132 A DSN in a connection string:
133
134 Note the leading semicolon on the connection string.
135
136 $ iusql ";DSN=WebDB" MyID MyPWD -w -b < My.sql
137
138 Options in the DSN may be overridden in the connection string:
139
140 $ iusql ";DSN=WebDB;Driver=PostgreSQL ODBC;UID=MyID;PASSWORD=secret;Debug=1;CommLog=1" -v
141
142
143 A string DSN:
144
145 A string DSN may be provided in its entirety, with no file DSN
146 reference at all:
147
148 $ iusql ";Driver=PostgreSQL Unicode;UID=MyID;PASSWORD=secret" -v
149
150
152 Cryptic error messages
153
154 Re-run isql or iusql with the -v flag to get more information
155 from errors, and/or enable Trace mode in odbcinst.ini.
156
157
158 Missing driver definition
159
160 Check that the driver name specified by the Driver entry in the
161 odbc.ini data-source definition is present in odbcinst.ini and
162 exactly matches the odbcinst.ini [section name].
163
164
165 Unloadable or incompatible driver
166
167 If the ODBC driver is properly specified for the data source, it
168 is possible that the driver is not loadable. Check for mix-ups
169 between Unicode and ANSI drivers, and verify the driver paths in
170 the odbcinst.ini [section name].
171
172
173 Unicode data sources with ANSI clients
174
175 Some data sources are Unicode-only and require the use of iusql.
176 If isql reports
177 [IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified
178 [ISQL]ERROR: Could not SQLConnect
179 but the data source and driver required are listed by
180 odbcinst -q -d
181 and
182 odbcinst -q -s
183 then try iusql.
184
185
187 /etc/odbc.ini
188 Configuration file containing system-wide Data Source Name (DSN)
189 definitions. See odbc.ini(5) for more information.
190
191 $HOME/.odbc.ini
192 Configuration file containing user-specific Data Source Name
193 (DSN) definitions. See odbc.ini(5) for more information.
194
195
197 unixODBC(7), odbcinst(1), odbc.ini(5)
198
199 "The unixODBC Administrator Manual (HTML)"
200
201
203 The authors of unixODBC are Peter Harvey <pharvey@codebydesign.com> and
204 Nick Gorham <nick@lurcher.org>.
205
206 For a full list of contributors, refer to the AUTHORS file.
207
208
210 unixODBC is licensed under the GNU Lesser General Public License. For
211 details about the license, see the COPYING file.
212
213
214
215version 2.3.11 Thu 14 Jan 2021 isql(1)