Interactive SQL utility for UltraLite (dbisql)

Executes SQL commands or runs command files.

Syntax
dbisql -c "connection-string" -ul [ options ] [ dbisql-command | command-file ]
Option Description
@data

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. See Using configuration files.

-c "connection-string" Required. Connect to the database as identified in the DBF or file_name connection 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.
-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.

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

-d1 Echo all statements explicitly executed by the user to the Command window (STDOUT). This echo can provide useful feedback for debugging SQL scripts, or when Interactive SQL is processing a long SQL script.
-f filename

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 -f option is given, the -c option is ignored; that is, no connection is made to the database.

If you do not include a full path to the file, a path relative to the current directory is assumed. If the file does not exist, or if it is a directory instead of a file, Interactive SQL prints an error message and then shuts down.

This option is only supported when Interactive SQL is run as a windowed application.

-nogui Run in command-prompt mode. If you specify either dbisql-command or command-file, then -nogui is assumed.
-onerror behavior

Control what happens if an error is encountered while reading data from the specified command file. Define one of the following supported behavior values:

  • Stop   Interactive SQL stops executing statements.

  • Prompt   Interactive SQL prompts the user to see if the user wants to continue.

  • Continue   The error is ignored and Interactive SQL continues executing statements.

  • Exit   Interactive SQL terminates.

  • Notify_Continue   The error is reporting, and the user is prompted to press Enter or click OK to continue.

  • Notify_Stop    The error is reported, and the user is prompted to press Enter or click OK to stop executing statements.

  • Notify_Exit   The error is reported and the user is prompted to press Enter or click OK to terminate Interactive SQL.

-q Set the utility to run in quiet mode. Suppress informational banners, version numbers, and status messages. Error messages are still displayed, however.
-ul

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. Perform this action by choosing the database type from the dropdown list on the Connect window.

-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 Scan commands, but do not execute them. This option is useful for checking long command files for syntax errors.
SQL-command | command-file

Execute the SQL statement or the specified command-file.

If you do not specify a SQL-statement or command-file, Interactive SQL enters interactive mode, where you can type a command into a command window.

Remarks

Interactive SQL allows you to execute SQL commands or run command files. It also provides feedback about:

When you connect to an UltraLite database, menu items that are SQL Anywhere-specific are not displayed in the interface. For example, Tools » Lookup Procedure Name, or Tools » Index Consultant.

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 their corresponding code pages), run ulcreate -l at a command prompt.

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 32-bit Windows desktop 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;

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 command line 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 also
Example

The following command runs the command 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. If there is an error in the command file, the process terminates.

dbisql -ul -c DBF=CustDB.udb -onerror exit mycom.sql