LinuxCommandLibrary

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
$ isql -d0x2C [dsn_name]
copy
Output as HTML table
$ isql -w [dsn_name]
copy
Use column headers with delimiter
$ isql -b -c -d0x09 [dsn_name]
copy

SYNOPSIS

isql [options] dsn [user] [password]

DESCRIPTION

isql is an ODBC command-line SQL client. It connects to any database with an ODBC driver.
The tool executes SQL queries interactively or from files. It provides database-agnostic access through ODBC.

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 HEX
Column delimiter as hex code (e.g., 0x09 for TAB, 0x2C for comma).
-c
Output column names on first row (with -d or -x).
-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.
-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. DSN must be configured. 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)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard