Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site

http://developer.mimer.com


Running BSQL


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.

It is only possible to specify up to 80 characters on the command line in BSQL. Input lines taken from a sequential file can be longer than 80 characters.

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:

Windows Example of a Batch File

The following is an example of the contents of a BAT file you could schedule to run on your Windows system:

 (echo your_name & echo your_password & echo read 'SomeFile.sql'; & echo exit;) | "c:\Program Files\MIMER91 NT\BSQL.exe" -m %your_DB_name%
 

Where:

Parameter
Description
 your_name
The user name to log on with.
 your_password
The user password to log on with.
 SomeFile.sql
The name of the file containing input or SQL commands.
 -m
Runs BSQL in multi user mode. The alternative is -s for single user mode.
 your_DB_name
The name of the database to work on.

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

UNIX-style
VMS-style
Function
 -m
 /MULTI
Connects to the database in multi-user mode.
 -s
 /SINGLE
Connects to the database in single-user mode.
 database_name
 database_name
Specifies the name of the database to access.

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 the Mimer SQL System Management Handbook.

If this is not set, it will be accessed 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.

Logging IN

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 Upright Database Technology AB. All rights reserved.
 
 
                               M I M E R / B S Q L
                                 Version 8.3.0 
 
 
                                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:

Use:
To:
 ctrl-a
Move to beginning of command
 ctrl-b
Move backwards in command
 ctrl-d
Delete current character
 ctrl-e
Move to end of command
 ctrl-f
Move forwards in command
 ctrl-h
Delete previous character
 ctrl-k
Delete after current position in command
 ctrl-n
Next command
 ctrl-o
Execute retrieved command and get next from history list
 ctrl-p
Previous command
 ctrl-r
Retrieve command by search condition
 ctrl-t
Change place for the previous two characters
 ctrl-u
Delete command
 ctrl-w
Delete before current position in command
 ctrl-<space>
Set mark in command (or 'esc <space>')
 ctrl-x ctrl-x
Go to mark set by 'ctrl <space>'
 ctrl-x ctrl-h
Show the history list
 ctrl-x ctrl-r
Retrieve command by history list number
 esc h
Delete previous word
 esc d
Delete next word
 esc b
Move to previous word
 esc f
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.


Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
dbtechnology@upright.se
Mimer SQL Documentation TOC PREV NEXT INDEX