BSQL can be run from a batch job or from a terminal. Operation from a terminal can be used to execute statements entered directly or written in sequential files.
About Complex SQL Statements - @
Use the @ character to delimit a complex SQL statement where the normal end-of-statement character `;' appears before the end of the statement (e.g. CREATE FUNCTION, CREATE PROCEDURE, and CREATE TRIGGER).
It is also useful to use @ in conjunction with large statements, e.g. CREATE SCHEMA, in which case the error reporting in BSQL will give more information about where the error occurred.
The use of @ cannot be used for grouping a number of simple SQL statements so that they execute as one single statement, but it is provided to give the SQL interpreter advance warning that a complex SQL statement appears between the @ characters which contains end-of-statement markers occurring before the true end of construct.
Running BSQL from a Batch Job
To run BSQL unattended from a batch job, create a batch file with the following contents:
- the command to start BSQL
- the user name
- the password
- the SQL statements and BSQL commands
- the EXIT command (or end of file).
Unicode Pipe Support in Console Programs on Windows
All Mimer SQL Engine console programs such as BSQL, can pipe Unicode files. The files can be any of the Unicode formats supported by Mimer SQL Engine such as UTF16 big and little endian, and UTF8.
When output is piped to a file, the input decides the type of the output file. If the input file is ASCII, the output will also be ASCII. If the input file is UTF16, the output will also be UTF16. If the input is from the keyboard, the output will be an UTF16 file on Windows NT/2000/XP and an ASCII file on Windows 98/ME (as this is the format returned by the respective input routines). For example:BSQL < UNIFILEIN.TXT > UNIFILEOUT.TXT
Security and Batch Jobs
For unattended operation, a batch file must either include the Mimer SQL ident user name and password in explicit form or connect as OS_USER.
For security reasons, make sure that your batch files are well protected and/or remove your password from the file after execution.
Alternatively, SQL statements and BSQL commands may be written in a sequential file without user name and password, and executed with the READ command from a BSQL terminal session.
Running BSQL via a Terminal
How you start BSQL depends on your operating system.
BSQL Command-line Arguments
Ident name to be used in connect. If only -u is given an attempt to connect as OS_USER is done. If the -u switch is not given the user is prompted for a username. Password for ident. If the switch is omitted the user is prompted for a password. When connecting as OS_USER, enter the -p switch only, without specifying password. Connects to the database in multi-user mode. Connects to the database in single-user mode. query can be any BSQL command or SQL statement. If a query is supplied, BSQL will terminate immediately after the query has been processed. Specifies the name of the database to access. If a database name is not specified, the default database will be accessed, see Mimer SQL System Management Handbook, The Default Database.
If a database name is not specified, the default database will be accessed.
If neither -s nor -m is specified for the optional mode flag, the way the database is accessed will be determined by the setting of the MIMER_MODE variable, see Mimer SQL Engine Systmen Management Handbook, Appendix A, Specifying Single-user Mode Access.
If this is not set, it will be accessed in multi-user mode.
If multiple instances of a qualifier is given, the last one is used. For examplebsql -s -m -ut1 -ut2
is valid and means connect user t2 in multi-user mode.
Running BSQL in UNIX
To start BSQL in UNIX, enter:bsql [-m | -s] [database_name]
Running BSQL in OpenVMS
To start BSQL in OpenVMS, enter:bsql [/MULTI | /SINGLE] [database_name]
Note: You can also use the UNIX-style syntax in OpenVMS.
Running BSQL in Windows
To start BSQL in a Windows command prompt window, enter:bsql [-m | -s] [database_name]
To start Mimer SQL from the Windows Start button:
Click Start, navigate to your Mimer SQL program group and select Batch SQL.
Starting BSQL displays the following screen:$ bsql MMMMM MMMMM MMMMM MMMMM MMMMM MMMMMMMMMM MMMMMMMM MMMMMM MMMMMM MMMMM MMMMMM MMMMMM MMMMMMMMMM MMMMMMMMM MMMMMM MMMMMM MMM MMMMMM MMMMMM MMM MMM MMM MMM MMMMMMMMMMMMM MMM MMMMMMMMMMMMM MMMMM MMMMMMM MMM MMMMM MMM MMM MMM MMMMM MMM MMM MMM MMM MMM MMMM MMM MMMM MMMMM MMMM MMM MMMM MMMMMMMMMM MMMM MMMM MMMM M MMMM MMMMM MMMM M MMMM MMMMMMMMMM MMMM MMMM (C) Copyright Mimer Information Technology AB. All rights reserved. M I M E R / B S Q L Version 9.2.2 Username:
After you have entered a user name and correct password, the BSQL prompt is displayed:SQL>
You can now enter BSQL commands and SQL statements. Output will be echoed on the terminal.
BSQL Command Line Editing - UNIX
Command line editing is available in the BSQL program, which uses a line-oriented interface.
The following functions are available:
Move to beginning of command Move backwards in command Delete current character Move to end of command Move forwards in command Delete previous character Delete after current position in command Next command Execute retrieved command and get next from history list Previous command Retrieve command by search condition Change place for the previous two characters Delete command Delete before current position in command Set mark in command (or `esc <space>') Go to mark set by `ctrl <space>' Show the history list Retrieve command by history list number Delete previous word Delete next word Move to previous word Move to next word
You can use the arrow keys for command retrieval and for positioning the cursor within a line, i.e. the same function as for ctrl-b, ctrl-f, ctrl-n and ctrl-p.
To change the number of commands that can be held in the history list, the environment variable MIMER_HISTLINES can be used (the default is 23).
Note: The operating system may have control sequences set for the terminal that, if they overlap, override those described above. The terminal settings can be listed using the UNIX stty -a command.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40