Mimer SQL User's Manual TOC PREV NEXT INDEX

Mimer Developer Site

www.mimer.com/developer


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

The '@' character should be used 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, 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:

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:

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.

Installing the Example Database

If, during the Mimer SQL installation, you chose to install the development and sample files, you have access to the script crehotdb.sql.

When run, the script creates a sample Mimer SQL environment containing databank files owned by the HOTELADM. The examples used in this manual are based on this environment.

To run the script, perform the following steps:
  1. Start BSQL.
  2. Log on as SYSADM.
  3. At the SQL-prompt, enter the command: READ 'crehotdb.sql';
  4. Exit from BSQL by entering: EXIT;
  5. To access the tables, logon with user name: HOTELADM and password: HOTELADM.

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 User's Manual TOC PREV NEXT INDEX