ASA Database Administration Guide
Database Administration Utilities
dbisql [ options ] [ dbisql-command | command-file ]
| Option | Description |
|---|---|
| -c "keyword=value; ..." | Supply database connection parameters. |
| -codepage codepage | Specify a codepage to use when reading or writing files. |
| -d delimiter | Use the given string as the command delimiter. |
| -d1 | Print statements as they are executed [command-prompt mode only]. |
| -datasource dsn-name | Specify an ODBC data source to connect to. |
| -f filename | Open (without running) the file called filename. |
| -host hostname | Specify the hostname or IP address of the machine running a database server. |
| -jConnect | Use jConnect to connect to the database. |
| -nogui | Run in command-prompt mode. |
| -ODBC | Use the iAnywhere JDBC Driver to connect to the database. |
| -onerror { continue | exit } | Override the ON_ERROR option for all users. |
| -port portnumber | Look on the specified port number for the database server. |
| -q | Quiet mode—no windows or messages (note that this does not suppress error messages). |
| -x | Syntax check only—no commands executed. |
Interactive SQL allows you to type SQL commands or run command files. It also provides feedback about the number of rows affected, the time required for each command, the execution plan of queries, and any error messages.
If dbisql-command is specified, Interactive SQL executes the command. You can also specify a command file name. If no dbisql-command or command-file argument is specified, Interactive SQL enters interactive mode, where you can type a command into a command window.
Exit codes are 0 (success) or non-zero (failure).
Interactive SQL requires that the QUOTED_IDENTIFIER database option be set to ON since a number of database functions, including some statements, rely on this setting to function properly. Interactive SQL automatically sets it ON when connecting to a database.
This utility does not accept the @data parameter to read in options from a configuration file.
Connection parameters (-c)
Specify connection parameters. See Connection parameters for a description of the connection parameters. If Interactive SQL cannot connect, you are presented with a dialog where you can enter the connection parameters.
Codepage (-codepage)
Specify the codepage to use when reading or writing files. The default code page is the default code page for the platform you are running on.
For example, on an English Windows NT machine, Interactive SQL uses the 1252 (ANSI) code page. If you want Interactive SQL to read files created using the 297 (IBM France) code page, specify the following option.
-codepage 297
For a list of supported code pages, see Supported code pages.
Command delimiter (-d)
Specify a command delimiter. Quotation marks around the delimiter are optional, but are required 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).
Echo statements (-d1)
(The final character is a number 1, not a lower-case L). Interactive SQL echoes all statements it executes to the Command window (STDOUT). This can provide useful feedback for debugging SQL scripts, or when Interactive SQL is processing a long SQL script.
Data source (-datasource)
Specify an ODBC data source to connect to. You do not need to be using the iAnywhere JDBC driver to use this option.
Open file using Interactive SQL (-f)
Open (but do not run) the file called filename. The file name can be enclosed in quotation marks, and must be enclosed in quotation marks if the file name contains a blank. If the file does not exist, or if it's really a directory instead of a file, Interactive SQL prints an error message to the console and then quits. If the file name does not include a full drive and path specification, it is assumed to be relative to the current directory.
Host (-host)
Specify the hostname or IP address of the computer on which the database server is running. You can use the name localhost to represent the current machine.
Use jConnect (-jConnect)
Use the Sybase jConnect JDBC driver to connect to the database.
Run in command-prompt mode (-nogui)
Run 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 this 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. The exit codes are as follows:
| Program exit code | Description |
|---|---|
| 0 | Success. |
| 1 | General failure. At some point, a SQL or Interactive SQL statement did not execute successfully and the user chose to stop executing SQL statements. Alternatively, Interactive SQL noted an internal error. |
| 5 | The user terminated interactive SQL. When an error occurs during execution, the user is prompted to ignore it, stop, or exit Interactive SQL. If the user opts to exit, the program returns code 5. Code 5 is also returned if an error occurs and the Interactive SQL option ON_ERROR is set to EXIT. |
| 9 | Unable to connect. |
| 255 | Bad command. The command contained incomplete or invalid options. |
Use iAnywhere JDBC driver (-ODBC)
Connect using the iAnywhere JDBC driver. This is the default method, and is recommended in most circumstances.
Override the ON_ERROR option setting (-onerror)
Controls what happens if an error is encountered while reading statements from a command file. This option overrides the ON_ERROR setting. It is useful when using Interactive SQL in batch operations.
For more information, see ON_ERROR option [Interactive SQL].
Database server port (-port)
Specify the port number on which the database server is running. The default port number for Adaptive Server Anywhere is 2638.
Operate quietly (-q)
Do not display output messages. This is useful only if you start Interactive SQL with a command or command file. Note that specifying this option does not suppress error messages.
Syntax check only (-x)
Scan commands but do not execute them. This is useful for checking long command files for syntax errors.
For detailed descriptions of SQL statements and Interactive SQL commands, see SQL Language Elements.
The following command, entered at a command prompt, runs the command file mycom.sql against the current default server, using the user ID DBA and the password SQL. If there is an error in the command file, the process terminates.
dbisql -c "uid=DBA;pwd=SQL" -onerror exit mycom.sql
The following command, when entered on a single line at a command prompt, adds a user to the current default database:
dbisql -c "uid=DBA;pwd=SQL" grant connect to joe identified by passwd
SQL Anywhere Studio 9.0.2
Copyright © 1989–2004 Sybase, Inc. Portions copyright © 2001–2004 iAnywhere Solutions, Inc. All rights reserved.