LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

isql

ODBC command-line SQL client

TLDR

Connect to data source
$ isql [dsn_name]
copy
Connect with credentials
$ isql [dsn_name] [username] [password]
copy
Connect with verbose error output
$ isql -v [dsn_name]
copy
Run in batch mode (no headers)
$ isql -b [dsn_name] < [query.sql]
copy
Use custom column delimiter (comma)
$ isql -d, [dsn_name]
copy
Output as HTML table
$ isql -w [dsn_name]
copy
Use column headers with tab delimiter (hex)
$ isql -b -c -x0x09 [dsn_name]
copy

SYNOPSIS

isql [options] dsn [user] [password]

DESCRIPTION

isql is an ODBC command-line SQL client included with unixODBC. It connects to any database with an ODBC driver using a DSN configured in odbc.ini, and executes SQL queries interactively or from a script piped on standard input.Built-in runtime commands include `help` (list tables), `help <table>` (list columns), and `quit` to exit the session.

PARAMETERS

DSN

Data source name from odbc.ini.
USER
Database username.
PASSWORD
Database password.
-v
Verbose mode with full error descriptions.
-b
Batch mode (no headers, no prompts).
-d DELIMITER
Column delimiter character (e.g., -d, for comma).
-x HEX
Column delimiter as a hex code (e.g., -x0x09 for TAB).
-c
Output column names on first row (use with -d or -x).
-m NUM
Limit column display width to NUM characters.
-w
Format output as HTML table.
-n
Use newline processing (multi-line SQL terminated with GO).
-e
Use SQLExecDirect instead of Prepare.
-k
Use SQLDriverConnect (DSN-less connection strings).
-l LOCALE
Set locale.
-3
Use ODBC 3 calls.
-L NUM
Maximum characters per field (default: 300).
-q
Wrap character fields in double quotes.
--version
Print version and exit.

CAVEATS

Requires ODBC drivers and a DSN configured in /etc/odbc.ini or ~/.odbc.ini. Part of unixODBC.

HISTORY

isql is part of unixODBC, providing command-line database access through the Open Database Connectivity standard.

SEE ALSO

psql(1), mysql(1), sqlcmd(1)

Copied to clipboard
Kai