Executes SQL commands and runs command files against a database.
dbisql [ options ] [ dbisql-command | command-file ]
Option | Description |
---|---|
@data |
Reads in options from the specified environment variable or configuration file. See Using configuration files. If you want to protect passwords or other information in the configuration file, you can use the File Hiding utility to obfuscate the contents of the configuration file. See File Hiding utility (dbfhide). |
-c "keyword=value; ..." |
Specifies connection parameters. If Interactive SQL cannot connect, you are presented with a window where you can enter the connection parameters. See Connection parameters. |
-d delimiter |
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. This option overrides the setting of the command_delimiter option. See command_delimiter option [Interactive SQL]. |
-d1 | Echoes all statements explicitly executed by the user to the command window (STDOUT). This can provide useful feedback for debugging SQL scripts, or when Interactive SQL is processing a long SQL script. (The final character is a number 1, not a lowercase L). This option is only available when you run Interactive SQL as a command line program. |
-datasource DSN-name | Specifies an ODBC data source to connect to. |
-f filename |
Opens (but does not run) in the SQL Statements pane the file called filename. If the -f option is given, the -c option is ignored; that is, no connection is made to the database. The file name can be enclosed in quotation marks, and must be enclosed in quotation marks if the file name contains a space. If the file does not exist, or if it is really a directory instead of a file, Interactive SQL prints an error message 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. This option is only supported when Interactive SQL is run as a windowed application. |
-host hostname | Specifies 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 computer. |
-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 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. See Software component exit codes. |
-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. It is useful when using Interactive SQL in batch operations. See on_error option [Interactive SQL]. |
-port port-number | Specifies the port number on which the database server is running. The default port number for SQL Anywhere is 2638. |
-q |
Suppresses output messages. This is useful only if you start Interactive SQL with a command or command file. Specifying this option does not suppress error messages, but it does suppress the following:
|
-ul |
Specifies that UltraLite databases are the default. Interactive SQL customizes the options available to you depending on the type of database you are connected to. By default, Interactive SQL assumes that you are connecting to SQL Anywhere databases. When you specify the -ul option, the default changes to UltraLite databases. Regardless of the type of database set as the default, you can connect to either SQL Anywhere or UltraLite databases by choosing the database type from the dropdown list on the Connect window. For more information about connecting to UltraLite databases from Interactive SQL, see Interactive SQL utility for UltraLite (dbisql). |
-version |
Displays the version number of Interactive SQL. You can also view the version number from within Interactive SQL; from the Help menu, choose About Interactive SQL. |
-x |
Scans commands but does 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. |
Interactive SQL allows you to browse the database, execute SQL commands, and 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.
You can connect to both SQL Anywhere and UltraLite databases.
Interactive SQL is supported on Windows, Solaris, Linux, and Mac OS X.
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.
You can start Interactive SQL in the following ways:
For Windows, there are two executables. Batch scripts should call dbisql or dbisql.com, not dbisql.exe. The dbisql.com executable is linked as a console application. The dbisql.exe executable is linked as a windowed application and does not block the command shell from which it was started. If dbisql.exe is run from a batch file, you won't see any output sent to the standard output or standard error files.
You can specify a code page to use when reading or writing files using the ENCODING clause of the INPUT, OUTPUT, or READ statement. For example, on an English Windows XP computer, windowed programs use the 1252 (ANSI) code page. If you want Interactive SQL to read a file named status.txt created using the 297 (IBM France) code page, use the following statement:
READ ENCODING 297 status.txt; |
The default code page for Interactive SQL can also be set using the default_isql_encoding option. See:
Exit codes are 0 (success) or non-zero (failure). Non-zero exit codes are set only when you run Interactive SQL in batch mode (with a command line that contains a SQL statement or the name of a script file). See Software component exit codes.
When executing a reload.sql file with Interactive SQL, you must specify the encryption key as a parameter. If you do not provide the key in the READ statement, Interactive SQL prompts for the key.
The following command 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 shuts down.
dbisql -c "UID=DBA;PWD=sql" -onerror exit mycom.sql |
The following command adds a user to the current default database:
dbisql -c "UID=DBA;PWD=sql" CREATE USER joe IDENTIFIED passwd |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |