Interactive SQL Command Line Options

Specify options when invoking Interactive SQL from a command prompt.

Interactive SQL Options

Option

Description

-c "keyword=value; ..."

Specifies connection parameters. If you do not specify this option, the environment variable SQLCONNECT is used. If Interactive SQL cannot connect, you see a dialog box where you can enter the connection parameters.

Note: Always specify connection parameters for Interactive SQL instead of relying on defaults. If you start more than one database on a server, for example, specify the database name, and in a network with subnets, specify the communications protocol parameter with host number.

-d delimiter

Specifies a command delimiter. Quotation marks around the delimiter are optional, except when the command shell itself interprets the delimiter in some special way.

Command delimiters are used for all connections in that Interactive SQL session, regardless of the setting stored in the database (for the user, or the PUBLIC setting).

-d1

(The final character is the number 1, not a lower case L.) Echoes all statements that Interactive SQL executes to the Command window (STDOUT). This feedback is useful when debugging SQL scripts, or when Interactive SQL is processing a long SQL script

-datasource dsn-name

Specifies an ODBC data source to connect to. You do not need to be using the SQL Anywhere® 16 JDBC driver to use this option. However, if the data source to which you are connecting is not configured to use TCP/IP, you must use the SQL Anywhere 16 JDBC driver to connect. By default, SAP Sybase IQ data sources are configured to use TCP/IP.

-f file name

Opens (but does not run) the file called file name. You must enclose the file name in quotes if the file name contains a blank; otherwise, quotes are optional. If the file does not exist, or if it is a directory instead of a file, Interactive SQL prints an error message to the console and quits. If the file name does not include a full drive and path specification, the file is assumed to be relative to the current directory.

-host host name

Specifies the host name or IP address of the computer on which the database server is running. You can use the name localhost to represent the current machine.

-nogui

Runs Interactive SQL in a command-prompt mode, with no windowed user interface. This is useful for batch operations. If you specify either dbisql-command or command-file, then -nogui is assumed.

In -nogui mode, Interactive SQL sets the program exit code to indicate success or failure. On Windows operating systems, the environment variable ERRORLEVEL is set to the program exit code. Exit codes are:

  • 0 — Success.

  • 1 — General failure. At some point, a SQL or Interactive SQL statement did not execute successfully and the you chose to stop executing SQL statements. Alternatively, Interactive SQL noted an internal error.

  • 5 — User terminated Interactive SQL. When an error occurs during execution, you are prompted to ignore the error, stop, or exit Interactive SQL. If you opt to exit, the program returns code 5. The program also returns code 5 if an error occurs and the Interactive SQL option ON_ERROR is set to EXIT.

  • 9 — Unable to connect.

  • 255 — Bad command. The command line contained incomplete or invalid switches.

Note: In -nogui mode, any SQL text you enter at the command prompt is executed when you press [Enter], even if you specify a command delimiter using the -d switch. Ensure the SQL command is complete before you press [Enter].

-onerror (continue | exit)

Controls what happens if an error is encountered while reading statements from a command file. This option overrides the on_error setting. This option is useful when using Interactive SQL in batch operations.

-port portnumber

Specifies the port number on which the database server is running. The default port number for SAP Sybase IQ is 2638.

-q

Runs in quiet mode—does not display output messages. This option is useful only if you start Interactive SQL with a command or command file. Specifying this option does not suppress error messages.

-version

Displays the version number of Interactive SQL.

-x

Scans commands but does not execute them. You may find this option useful for checking long command files for syntax errors.

Related concepts
Interactive SQL Connection Parameters
Related tasks
Starting Interactive SQL from a Command Prompt
Starting Interactive SQL from the Windows Start Menu
Related reference
Interactive SQL Utility Syntax