Running Mimer SQL Applications
This chapter describes how to run applications in the Mimer SQL environment.
It covers information that applies to the utilities included in the Mimer SQL installation as well as to applications that may have been created to access a Mimer SQL database.
This chapter also describes:
- Defining whether OpenVMS-style or Unix-style command-line flags are accepted by the utilities which are supplied as part of the Mimer SQL installation.
- Selecting a Mimer SQL installation - if several Mimer SQL installations reside on the same computer, it is essential that users access the correct one.
Executing Mimer SQL Utilities
This section describes the various ways an application can be executed under OpenVMS and also describes how to set up the Mimer SQL-supplied utilities to use Unix-style or OpenVMS-style command-line flags.
Using the DCL command RUN
The DCL command RUN can be used as follows:$ RUN MIMEXE:BSQL
You cannot specify any flags or other input parameters on the command-line when you use the RUN command.
Some of the Mimer SQL-supplied programs allow parameters and options to be supplied via logical names, e.g. MIMER_DATABASE to supply a database name and MIMER_MODE to define the database access mode.
See documentation for the programs in the Mimer SQL System Management Handbook for specific details.
Using OpenVMS Command Definitions
You can set up the programs supplied by Mimer SQL so that they can be run by specifying the program name followed by the VMS-style command line flags and parameters.
You do this by defining the Mimer SQL programs as DCL command verbs.
Use the following OpenVMS command to define all the Mimer SQL-supplied programs as DCL command verbs:$ SET COMMAND MIMLIB:MIMER
Example using OpenVMS-style command-line arguments:$ BSQL/SINGLE TESTDB
You can un-define a DCL command by issuing the following command:$ SET COMMAND/DELETE=command-name
Using the DCL$PATH Logical Name
The DCL$PATH logical name defines a list of directories in which the OpenVMS operating system will look when trying to locate the executable for a specified program name.
Utilities started this way accept Unix-style command options.
Note: If you set up a Mimer SQL-supplied utility as a DCL command verb, the Unix-style command-line flags and parameters are not used, even if MIMEXE is included in DCL$PATH.
In order for the utilities supplied by Mimer SQL to be run by specifying the utility name followed by the Unix-style command line flags and parameters, you must include the MIMEXE directory in the directory list defined in DCL$PATH.
If there are other directories containing executables for programs that are to be run this way, those directories must also be included in the directory list defined in DCL$PATH.
For example, the following DCL$PATH definition:$ DEFINE DCL$PATH MIMEXE,disk:<directory.app>
will allow the utilities supplied by Mimer SQL to be run by specifying the utility name followed by the Unix-style command line flags and parameters.
It will also allow all programs found in the specified application directory to be run by specifying the program name.
Example using Unix-style command-line flags:$ bsql -s testdb
Running a BSQL Script
BSQL can be used to run SQL commands from within a script. There are several ways to use BSQL and some examples are given here.
You can use the READ command from within BSQL to read a file containing SQL statements:$ CREATE Q.SQL SELECT 1+1 FROM SYSTEM.ONEROW; $ BSQL/USER=SYSADM/PASSW=SYSADM READ 'Q.SQL';
To use BSQL from within a command procedure (.COM file), you do like this:$ BSQL SYSADM SYSADM SELECT 1+1 FROM SYSTEM.ONEROW; $ ! next DCL command beginning with dollar ends program input.
To execute a single SQL command, the /QUERY switch can be used with BSQL:$ BSQL/USER=SYSADM/PASSW=SYSADM/QUERY="SELECT 1+1 FROM SYSTEM.ONEROW"
The VMS command PIPE can be used to create Unix-like pipes with Unix-like redirection. This command reads SQL statements from the file Q.SQL:$ PIPE BSQL/USER=SYSADM/PASSW=SYSADM < Q.SQL > RESULT.TXT
Old-time VMS users would achieve the same thing by redefining SYS$INPUT and SYS$OUTPUT. By defining them in USER mode, the definitions are dropped automatically at image (program) exit:$ DEFINE/USER SYS$INPUT Q.SQL $ DEFINE/USER SYS$OUTPUT RESULT.TXT $ BSQL/USER=SYSADM/PASSW=SYSADM
A problem with all the examples above is that the password for the Mimer ident used is stored in a file. This should generally be avoided unless the security of the file can be guaranteed.
The problem can be solved by adding an OS_USER login to the user. A user with an OS_USER login can log in without providing a password. (This does not work over TCP/IP.)
For example:$ BSQL /USER=SYSADM /PASSW="SYSADM" SQL> CREATE IDENT PER AS USER; SQL> ALTER IDENT PER ADD OS_USER 'PER'; SQL> EXIT;
Now VMS user PER can do:$ BSQL /USER="" /QUERY="SELECT 1+1 FROM SYSTEM.ONEROW"
Selecting a Mimer SQL Installation
A host computer can have several versions of the Mimer SQL database system installed simultaneously.
Access to a specific version is done through logical names (MIMEXE, etc.). If several versions of Mimer SQL version are installed, you can use the MIMSETUP command procedure to specify exactly which version a program should work with.
Normally, you do a system wide definition of the logical names. However, you can specify another Mimer SQL version by running the MIMSETUP command procedure and specifying a GROUP, JOB or PROCESS logical name definition (see MIMSETUP Syntax for details on MIMSETUP).
Note: When starting a database server, any JOB or PROCESS logical names will not be inherited by the database server process. The database server will use the Mimer SQL version specified in the GROUP or SYSTEM logical name tables.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40