Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - Database Management and Reference » UltraLite Utilities Reference

Supported exit codes Next Page

Interactive SQL utility (dbisql) for UltraLite


Executes SQL commands or runs command files provided.

Syntax

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 ]

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.

-c "connection-string"

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.

-codepage number

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.

-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 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 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.

-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.

-x

Scan commands but do not execute them. This is useful for checking long command files for syntax errors.

-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 by choosing the database type from the dropdown list on the Connect dialog.

dbisql-command|command-file

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.

Remarks

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.

See also
Example

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