Как в linux isql

DESCRIPTION¶

isql and iusql 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.

iusql is the same as isql but includes built-in Unicode support. Some data sources only work with iusql.

ARGUMENTS¶

DSN 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.

USER Specifies the database user or role under which the connection should be made.

This parameter overrides any UID specified in the data source configuration files.

PASSWORD Password required to access the database for the specified USER.

This parameter overrides any PASSWORD specified in the data source configuration files.

OPTIONS¶

-b Run ‘isql’ in non-interactive batch mode. In this mode, ‘isql’ processes from standard input, expecting one SQL command per line.

-dDELIMITER Delimit columns with the specified delimiter.

-xHEX Delimit columns with the character represented in hexadecimal by HEX. The hexadecimal code must be in the format 0xNN (e.g. 0x09 for the TAB character).

-w Format the result as an HTML table.

-c Output the names of the columns on the first row. This option can only be used with the -d or -x options.

-mNUM Limit the column display width to NUM characters.

-lLOCALE Set the character locale to LOCALE.

-q Wrap the character fields in double quotes.

-3 Use calls from ODBC version 3.

-n Process multiple lines of SQL, terminated with the GO command.

-e Use SQLExecDirect instead of Prepare.

-v Enable verbose mode, fully describing all errors. This option is useful for debugging.

—version Display the program version.

-LNUM Set the maximum number of characters displayed from a character field to NUM. The default value is 300 characters.

COMMANDS¶

This section briefly describes some isql and iusql run-time commands.

Читайте также:  Linux gcc 32 bit on 64 bit

Источник

isql — Man Page

isql and iusql 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.

iusql is the same as isql but includes built-in Unicode support. Some data sources only work with iusql.

Arguments

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.

Specifies the database user or role under which the connection should be made.

This parameter overrides any UID specified in the data source configuration files.

Password required to access the database for the specified USER.

This parameter overrides any PASSWORD specified in the data source configuration files.

Options

Run ‘isql’ in non-interactive batch mode. In this mode, ‘isql’ processes from standard input, expecting one SQL command per line.

Delimit columns with the specified delimiter.

Delimit columns with the character represented in hexadecimal by HEX. The hexadecimal code must be in the format 0xNN (e.g. 0x09 for the TAB character).

Format the result as an HTML table.

Output the names of the columns on the first row. This option can only be used with the -d or -x options.

Limit the column display width to NUM characters.

Set the character locale to LOCALE.

Wrap the character fields in double quotes.

Use calls from ODBC version 3.

Process multiple lines of SQL, terminated with the GO command.

Use SQLExecDirect instead of Prepare.

Enable verbose mode, fully describing all errors. This option is useful for debugging.

Display the program version.

Set the maximum number of characters displayed from a character field to NUM. The default value is 300 characters.

Commands

This section briefly describes some isql and iusql run-time commands.

List all tables in the database.

help table

List all columns in the table.

Examples

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 -n option is specified).

Читайте также:  Tacacs server linux установка настройка

A DSN in a connection string:

Note the leading semicolon on the connection string.

Options in the DSN may be overridden in the connection string:

A string DSN may be provided in its entirety, with no file DSN reference at all:

Troubleshooting

Re-run isql or iusql with the -v flag to get more information from errors, and/or enable Trace mode in odbcinst.ini.

Missing driver definition

Check that the driver name specified by the Driver entry in the odbc.ini data-source definition is present in odbcinst.ini and exactly matches the odbcinst.ini [section name].

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 [section name].

Unicode data sources with ANSI clients

Some data sources are Unicode-only and require the use of iusql. If isql reports

[IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified [ISQL]ERROR: Could not SQLConnect

but the data source and driver required are listed by

then try iusql.

Files

Configuration file containing system-wide Data Source Name (DSN) definitions. See odbc.ini(5) for more information.

Configuration file containing user-specific Data Source Name (DSN) definitions. See odbc.ini(5) for more information.

See Also

«The unixODBC Administrator Manual (HTML)«

Authors

The authors of unixODBC are Peter Harvey pharvey@codebydesign.com> and Nick Gorham nick@lurcher.org>.

For a full list of contributors, refer to the AUTHORS file.

unixODBC is licensed under the GNU Lesser General Public License. For details about the license, see the COPYING file.

Referenced By

The man page iusql(1) is an alias of isql(1).

Источник

isql (1) — Linux Manuals

isql is a command line tool which allows the user to execute SQL in batch or interactively. It has some interesting options such as an option to generate output wrapped in an HTML table.

iusql is the same tool with built-in Unicode support.

ARGUMENTS

DSN The Data Source Name, which should be used to make connection to the database. The data source is looked for in the /etc/odbc.ini and $HOME/.odbc.ini files in that order, with the latter overwriting the former.

USER Specifies the database user/role under which the connection should be made.

Читайте также:  Сделать usb загрузочной linux

PASSWORD Password for the specified USER.

OPTIONS

-b Run isql in non-interactive batch mode. In this mode, the isql processes its standard input, expecting one SQL command per line.

-dDELIMITER Delimits columns with delimiter.

-xHEX Delimits columns with HEX, which is a hexadecimal code of the delimiting character in the format 0xNN — i.e. 0x09 for the TAB character.

-w Format the result as HTML table.

-c Output the names of the columns on the first row. Has any effect only with the -d or -x options.

-mNUM Limit the column display width to NUM characters.

-lLOCALE Sets locale to LOCALE.

-q Wrap the character fields in double quotes.

-3 Use the ODBC 3 calls.

-n Use the newline processing.

-e Use the SQLExecDirect instead of Prepare.

-k Use SQLDriverConnect.

-v Turn on the verbose mode, where the errors are fully described. Useful for debugging.

—version Prints the program version and exits.

COMMANDS

List all tables in the database.

help table List all columns in the table.

help help List all help options.

EXAMPLES

$ isql WebDB MyID MyPWD -w -b < My.sql

Connects to the WebDB as user MyID with password MyPWD, then execute the commands in the My.sql file and returns the results wrapped in HTML table. Each line in My.sql must contain exactly 1 SQL command, except for the last line, which must be blank (unless the -n option is specified).

FILES

/etc/odbc.ini System-wide DSN definitions. See odbc.ini(5) for details.

$HOME/.odbc.ini User-specific DSN definitions. See odbc.ini(5) for details.

AUTHORS

The authors of unixODBC are Peter Harvey pharvey [at] codebydesign.com> and Nick Gorham nick [at] easysoft.com>. For the full list of contributors see the AUTHORS file.

unixODBC is licensed under the GNU Lesser General Public License. For details about the license, see the COPYING file.

SEE ALSO

  • isql-fb (1) - Firebird Interactive SQL shell
  • isc-config (1) - Get information about the installed version of ISC BIND
  • isc-config.sh (1) - Get information about the installed version of ISC BIND
  • ischroot (1) - detect if running in a chroot
  • isdnbill (1) - report isdn costs
  • isdnconf (1) - manipulate or read ISDN phone number config files.
  • isdnrate (1) - Print telephone rates and various info from rate-files(5).
  • isdnrep (1) - report ISDN activity
  • fisql (1) - interactive SQL shell

Источник

Оцените статью
Adblock
detector