Executes SQL statements and runs script files against a database.
dbisql -c "connection-string" [ options ] [ dbisql-statement | dbisql-script-file ]
dbisql -c "connection-string" -ul [ options ] [ dbisql-statement | dbisql-script-file ]
dbisql-statement: A SQL statement or a series of sql statements separated by a command-delimiter.
Option | Description |
---|---|
@data |
Reads in options from the specified environment variable or configuration file. If both the environment variable and configuration file exist with the same name, the environment variable is used. See 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. If you do not specify both a user ID and a password, the default UID of DBA and PWD of sql are assumed. See Connection parameters. |
-d delimiter |
Specifies 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) the file called filename in the SQL Statements pane. 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 as a console application, with no windowed user interface. This is useful for batch operations. If you specify either dbisql-statement or dbisql-script-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 script file. It is useful when using Interactive SQL in batch operations. This option overrides the on_error setting. See on_error option [Interactive SQL]. Define one of the following supported behavior values:
|
-q |
Suppresses output messages. Sets the utility to run in quiet mode. This is useful only if you start Interactive SQL with a statement or script 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 Change Database Type dropdown list on the Connect window. For more information about connecting to UltraLite databases from Interactive SQL, see Interactive SQL for UltraLite utility (dbisql). |
-version |
Displays the version number of Interactive SQL. You can also view the version number from within Interactive SQL; from the Help menu, click About Interactive SQL. |
-x |
Scans statements but does not execute them. This is useful for checking long script files for syntax errors. For detailed descriptions of SQL statements and Interactive SQL statements, see SQL language elements. |
dbisql-statement | dbisql-script-file |
Execute the SQL statement or execute the specified dbisql-script-file. If you do not specify a dbisql-statement or dbisql-script-file, Interactive SQL enters interactive mode, where you can type a statement into a command window. |
Interactive SQL allows you to browse the database, execute SQL statements, and run script files. It also provides feedback about:
You can connect to both SQL Anywhere and UltraLite databases. For information about connecting to SQL Anywhere databases, see Interactive SQL utility (dbisql).
Interactive SQL is supported on Windows, Solaris, Linux, and Mac OS X. See http://www.sybase.com/detail?id=1061806.
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.
The default encoding for Interactive SQL can also be temporarily set using the default_isql_encoding option. See default_isql_encoding option [Interactive SQL].
You can specify the encoding to use when reading or writing files using the ENCODING clause of the INPUT, OUTPUT, or READ statement. 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.
In command-prompt 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.
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.
You can start Interactive SQL in the following ways:
The following command runs the script file mycom.sql against the CustDB.udb database for UltraLite. Because a user ID and password are not defined, the default user ID DBA and password sql are assumed. The -onerror option is defined as Exit; so, if there is an error in the script file, the process terminates.
dbisql -ul -c DBF=CustDB.udb -onerror exit mycom.sql |
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |