Executes SQL commands or runs command files provided.
The syntax described below is specific to UltraLite usage. For syntax specific to SQL Anywhere usage, see Interactive SQL utility (dbisql).
dbisql -c "connection-string" [ options ] [ dbisql-command | command-file ]
Read options from the specified environment variable or configuration file. If both exist with the same name, the environment variable is used.
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.
Required. Connect to the database as identified in the DBF or file_name parameter of your connection-string. If you do not specify both a user ID and a password, the default UID of DBA and PWD of sql are assumed.
Specify a codepage to use when reading or writing files. The default code page is the default code page for the platform you are running on.
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.
Echo 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.
Open (but do not run) the file called filename. Enclose the file name 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 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.
Run in command-prompt mode. If you specify either dbisql-command or command-file, then -nogui is assumed.
Control what happens if an error is encountered while reading data from the specified command file. Define one of the following supported behavior values:
Set the utility to run in quiet mode. Suppress informational banners, version numbers, and status messages. Error messages are still displayed, however.
Scan commands but do not execute them. This is useful for checking long command files for syntax errors.
Connect to UltraLite databases by default.
By default, Interactive SQL assumes that you are connecting to SQL Anywhere databases. When you specify the -ul option, the default becomes UltraLite connections. 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 dialog.
Execute the SQL command provided, or those specified in the command-file name.
Alternatively, if you do not specify a dbisql-command or command-file, Interactive SQL enters interactive mode, where you can type a command into a command window.
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 you connected to an UltraLite database, certain menu items that are SQL Anywhere-specific are not displayed in the interface. For example, Tools > Lookup Procedure Name, or Tools > Index Consultant.
About code pages In UltraLite, collations include a code page plus a sort order. Therefore, code page numbers correspond to the number displayed as part of the UltraLite collation name. To see a list of supported collations (and its corresponding codepage), run ulcreate -l at a command prompt.
For example, on an English 32-bit Windows desktop computer, windowed programs use 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.
About exit codes 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).
In no GUI 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 following command, entered at a command prompt, runs the command file mycom.sql against the CustDB.udb database for UltraLite, using the default user ID DBA and the password sql. If there is an error in the command file, the process terminates.
dbisql -ul -c DBF=CustDB.udb -onerror exit mycom.sql