Development and Example Environments

 

When installing Mimer SQL, there are options to install an initial development setup and an example database. The example database is described in detail in the article The Example database, found as https://developer.mimer.com/article/the-example-database/.

If these parts were not installed during the dbinstall session, they can be installed separately when needed. For the initial development setup, use the following command:

# mimdevenv <database name>

 

For the example database, use the following command:

# mimexampledb <database name >

 

To access the example environments, you can use:

DbVisualizer

The GUI database front-end included in the installation package and located in the desktop setup for Mimer SQL.

bsql

The command line tool, usually available as /usr/bin/bsql.

Any ODBC or JDBC based SQL tool

Standard database access tools using these database API’s can be adapted.

The username MIMER_STORE and password ‘GoodiesRUs’ (if you have used the default password) is used for the example database.

For further information on the API’s described below, and on programming with Mimer SQL in general, please refer to the Programmer's Manual within the Mimer SQL Documentation Set - https://docs.mimer.com/MimerSqlManual/latest/.

Database APIs

Embedded SQL

An embedded SQL preprocessor is included. It enables SQL commands to be embedded in programs written in C, C++ and FORTRAN. The embedded syntax complies with the ISO standard for embedded SQL.

For a proper Unicode behavior, internationalized C/C++ programs must include the locale.h header file and call the setlocale() operating system function to initiate a specific language operation. This can be done by calling setlocale() as follows:

setlocale(LC_ALL, "");

 

In the examples directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_esql.txt.

Module SQL

A Module SQL preprocessor is included. It enables separation of SQL code and a host application written in C, FORTRAN, COBOL or Pascal, into different source files, simplifying modularity and reuse of SQL code.

For a proper Unicode behavior, internationalized C programs must include the locale.h header file and call the setlocale() operating system function to initiate a specific language operation. This can be done by calling setlocale() as follows:

setlocale(LC_ALL, "");

 

In the examples directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_msql.txt.

JDBC

For database access from Java a JDBC driver is included in the distribution. The driver is a type 4 driver, which means that it is written entirely in Java. This provides the driver with full portability so that it can be copied or downloaded to any Java enabled platform. The driver uses TCP/IP to access a Mimer SQL server (version 8.2 or later) on any platform. For details on the JDBC drivers, please refer to the Mimer JDBC Driver Guide, https://docs.mimer.com/MimerJdbcGuide/latest/.

In the JDBC directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_java.txt.

ODBC

The Mimer ODBC driver is a client library that enables applications to access Mimer SQL database servers running on any platform. The driver complies with the ODBC 3.52 specification.

There are various third party ODBC Driver Manager available on the market that enable applications to dynamically load drivers for different database products. But, you can also choose to link your applications directly to the Mimer ODBC driver, without using any Driver Manager. In the latter case we suggest usage of the provided ODBC header files, introduced by including the mimcli.h file.

For a proper Unicode behavior, internationalized programs must include the locale.h header file and call the setlocale() operating system function to initiate a specific language operation. This can be done by calling setlocale() as follows:

setlocale(LC_ALL, "");

 

In the ODBC environment it can be mentioned that SQLWCHAR refers to a four byte type (wchar_t).

In the examples directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_odbc.txt.

Mimer SQL C API

Mimer SQL C API is a native C library suitable for tool integration and application development in environments where API standardization is not a requirement. The following characteristics describe the API:

Simplicity

Platform independence

Small footprint

Tight fit with the Mimer SQL application/database communication model.

This MimerAPI is provided in the libmimerapi.dylib shared library. The mimerapi.h header file provides prototypes and other handy defines. See Database API article for MimerAPI and the Mimer SQL Programming Manual (found in the Mimer SQL Documentation Set at the Documentation page.)

For a proper Unicode behavior, internationalized programs must include the locale.h header file and call the setlocale() operating system function to initiate a specific language operation. This can be done by calling setlocale() as follows:

setlocale(LC_ALL, "");

 

In the examples directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_mimerapi.txt.

Python

A Mimer SQL database can be accessed from the Python programming language using the MimerPy adapter. This adapter allows the user to connect to Mimer SQL through Python, gaining access to the exceptional performance and powerful features provided by a Mimer SQL database.

For details and programming examples, please see the specific MimerPy guide found as https://docs.mimer.com/MimerPython/latest/, and the article at https://developer.mimer.com/article/mimer-sql-python-adapter/.

PHP

A Mimer SQL database can be accessed from HTML using the PHP/ODBC interface. PHP is a widely-used general-purpose scripting language that can be embedded into HTML, and is therefore especially suited for web development.

In the examples directory under the installation path, e.g. /opt/mimersql1100-11.0.0A/examples, there is a basic programming example provided along with a readme file named readme_php.txt. This example uses the Apache HTTP Server which is an open source HTTP web server for a wide range of platforms.

Also see the article describing the PHP/PDO access method, https://developer.mimer.com/article/mimer-sql-driver-for-pdo/.

Accessing the database

Setting up and running DbVisualizer

DbVisualizer is a graphical front-end used to view and manage your database objects. It is started from the desktop using an icon in the Mimer SQL installation menu.

To use DbVisualizer you may need to install Java. Once Java is installed DbVisualizer is started. The very first time DbVisualizer is started two operations are automatically initiated:

First the New Connection Wizard is started

This wizard will set up a connection to the Mimer SQL database:

1It will initially prompt for a name of the connection. A common naming scheme is to use the database name followed by the username in parenthesis. For example ‘testdb (MIMER_STORE)’.

2In the second step the database driver should be selected. Select ‘Mimer’ from the drop down list.

3In the third step you fill in the database name, username, and password used when accessing the Mimer SQL server. Enter the name of the target database. If the Mimer SQL Example database is installed, the username MIMER_STORE and password ‘GoodiesRUs’ (if you have used the default password) can be used. If your database is on another computer remember to change the Server field to the name of the computer. Before proceeding, make sure you test that your connection is working properly.

4The wizard is now completed and various objects in the target database can now be explored by selecting them in the tree view to the left. Note that existing objects can be modify and new ones can be created by right-clicking on the objects or object types.

Secondly, when DbVisualizer is invoked for the first time

The Driver Finder will locate the Mimer SQL JDBC Driver. Unless errors have occurred, this dialog can simply be closed.

Running Mimer BSQL and other utilities

In order to run most of the Mimer SQL utilities from a command prompt window, a target database to access must be specified. This can be furnished in different ways:

Enter the database name on the command line, e.g.:

# bsql database_name

 

As mentioned before, use the environment variable MIMER_DATABASE, e.g.:

# export MIMER_DATABASE=database_name

# bsql

 

Use an ODBC data source. When installing a database using the dbinstall command, the default option is to define the database as an ODBC DSN (if such an ODBC environment is present).

The order of the three methods is significant as the first methods override the later ones. For example, specifying the database on the command line overrides the setting of the MIMER_DATABASE environment variable.

Environment Variables

The following table lists and explains the environment variables Mimer SQL uses.

Variable

Explanation

HOME

Used to locate the home directory from within various Mimer SQL programs.

LD_LIBRARY_PATH

Used on most platforms to locate shared libraries in runtime.

On macOS the following resources are used until it finds a compatible Mach-O file: $LD_LIBRARY_PATH, $DYLD_LIBRARY_PATH, current working directory, $DYLD_FALLBACK_LIBRARY_PATH.

MIMER_DATABASE

Used to point out which database to access. If not set, the default database, set in /etc/sqlhosts, is used.

MIMER_EXTEND

Used to change the number of pages to allocate when dynamically extending a databank file.

If not set, the default is 128 pages (each of 4096 bytes). The variable must be set for the process starting the database server program.

MIMER_HISTLINES

Used to change the number of command lines to be stored in the recorded history for a Mimer BSQL session.

If not set, the default is 23.

MIMER_KEYFILE

If set, the given string is treated as the name of the license key file (overriding the /etc/mimerkey file).

MIMER_MODE

Used to indicate the mode for which the database should be accessed, that is, SINGLE or MULTI.

Use single mode if accessing a database for which the database server program is not started. If not set, MULTI is assumed.

MIMER_NOEDIT

If set, the command line editing package for a Mimer BSQL session is disabled.

MIMER_ODBCINI

If set, the given string is treated as the name of the file for ODBC Data Source lookup.

If not set, and if ODBCINI is not set, the home directory is searched for the .odbc.ini file (using the HOME environment variable).

MIMER_SQLHOSTS

The default sqlhosts file is /etc/sqlhosts. Another file can be used by defining the MIMER_SQLHOSTS environment variable to hold the path of the target sqlhosts file.

ODBCINI

Same as MIMER_ODBCINI.

Overrides MIMER_ODBCINI if set.

PATH

Used to locate Mimer executables.

SHELL

Used shell when temporarily entering the operating system shell prompt from within Mimer SQL.

If not set, /bin/sh is used.

TMPDIR

If set, it is used as the placeholder for temporary files created by Mimer SQL. If it is not set, the directory $HOME/.mimer_tmp is used.

macOS Commands

Command

Function

Used by

bsql

SQL command interpreter. See Mimer SQL User’s Manual, Chapter 9, Mimer BSQL for more information.

mimdevenv, mimexampledb

dbc

Databank check utility. See the chapter Databank Check Functionality in System Management Handbook for more information.

 

dbfiles

Lists the databank files for a database server, as stored in the data dictionary.

mimdbfiles

dbinstall

Command used to install a new database, or update an existing one.

mimexampledb

dbopen

Opens all user defined databanks at once. See Chapter 7, Databank Open Function in System Management Handbook for more information.

 

dbuninstall

Command used to remove a database, including its data files, registrations and related resources.

 

esql

Embedded SQL preprocessor. See Mimer SQL Programmer’s Manual, Chapter 4, Embedded SQL for more information.

 

exload

Program used to create or delete the example environment. (I.e. MUSIC_STORE, see https://developer.mimer.com/article/the-example-database/)

dbinstall, mimexampledb

mimaddpath

Used to add a value to an environment variable (with duplicate check). The new definition is displayed – not installed. Especially used to update the shared library search path.

(internal use)

mimadmin

Menu-based database server administration utility.

 

mimautoset

Switches on/off the automatic server start and stop functionality or gives the current state of this interaction with the operating system.

dbinstall

mimcontrol

Manages database servers. See Chapter 4, Managing a Database Server in System Management Handbook for more information.

dbinstall, mimadmin, mimlistdb

mimdbfiles

Lists the databank file names for a database server, as stored in the file system. Can also be used to change the ownership of the databank files (i.e. the new owner will be the one that is dedicated to manage the database server).

In addition, the command can be used for displaying the database server log and configuration files.

dbinstall, dbuninstall, mimadmin

mimdbserver

A front-end to the mimcontrol and miminfo programs, used to control and monitor the database server.

dbinstall, dbuninstall, mimadmin, mimdbfiles

mimdevenv

Command used to create a beginner's development environment.

dbinstall

mimdumper

Creates or executes the .dumper.sh file for a database server.

The functionality is used to get detailed operating system info about the process where the database server program is executed, especially in the case of a system failure.

dbinstall

mimexampledb

Installs the example database environment. (Invokes the exload program.)

 

mimexec

mimexec command is used to execute a given program and stay attached. This command is used internally, especially when invoking terminal based programs using icons on the desktop

(mainly for internal use)

mimexper

The Mimer SQL Experience database server program. You start mimexper using the mimcontrol or mimdbserver commands.

mimcontrol

mimhome

Displays the home directory for the effective user. Especially used to find location for log and tmp files.

(mainly for internal use)

mimhosts

Program to manage and to do lookup in the /etc/sqlhosts file. See The sqlhosts file for more information.

dbinstall, dbuninstall, mimadmin, mimowner, mimdbfile, mimdbserver, mimdevenv, mimexampledb, mimexec

miminetd

Command used to administer Mimer SQL in the operating system Internet services daemons.

dbinstall

miminfo

Program to monitor database servers. See Chapter 4, Managing a Database Server in System Management Handbook for more information.

mimadmin

miminm

Mimer SQL In-memory database server.

 

miminstall

Command delivered with the distribution TAR file used to unpack and install Mimer SQL.

 

mimjdbcver

Displays the version of the JDBC drivers delivered with Mimer SQL.

 

mimlicense

Used to manage the license keys in /etc/mimerkey. See Mimer SQL license key for more information.

mimadmin, miminstall

mimlink

Used to link Mimer SQL libraries, man pages and executables to /usr/lib, /usr/man and /usr/bin, respectively.

miminstall

mimlistdb

Lists started database servers.

mimadmin, mimuninstall

mimload

A command line front end to the Mimer SQL Load/Unload functionality.

 

mimlocation

Displays the location of the Mimer SQL installation currently accessed.

(mainly for internal use)

mimmem

Lists current limits on memory usage.

 

mimodbc

Program used to administer ODBC data sources and ODBC drivers (especially aimed at the managing iODBC data sources, see http://www.iodbc.org.)

mimodbcadmin, mimodbcdm

mimodbcadmin

Menu based ODBC data source and ODBC driver administration

dbinstall, dbuninstall

mimodbcdm

A front-end to the mimodbc program, used to administer ODBC data sources and drivers.

mimodbcadmin

mimowner

Displays the name of the operating system user that is dedicated to manage a specific database server.

mimadmin, mimdbfiles, mimdbserver

mimpath

Gets the path to databank locations.

dbinstall, dbuninstall, mimadmin, mimdbfiles, mimexampledb, mimowner

mimperf

Used to monitor a running database server.

 

mimproc

Lists various system information for a running process.

.dumper.sh

mimrepadm

Program used to administrate the Mimer SQL replication dictionary.

 

mimservers

Starts/stops all database servers (of current version) defined in /etc/sqlhosts.

mimautoset

mimsqlhosts

A front-end to the mimhosts program, used to control the database registration file /etc/sqlhosts.

dbinstall, mimadmin

mimstatln

Used to follow and display the source for a symbolic link.

(mainly for internal use)

mimsync

Program used to synchronize replicated Mimer SQL tables.

 

mimsysconf

Displays the values of various host system configuration parameters, all related to the Mimer SQL system performance.

 

mimtcp

Manages TCP port dispatching, i.e. distributing incoming connect-attempts to the requested database server.

 

mimuninstall

Command to uninstall Mimer SQL, if installed via the tar package.

 

mimunlink

Command used to remove symbolic links from /usr/bin, /usr/share/man and /usr/lib, previously created by the mimlink command.

mimuninstall

mimversion

Command used to get the installed Mimer SQL version.

mimadmin, mimodbcadmin

repserver

The Mimer SQL replication server program. See REPSERVER - Replicating the Data in System Management Handbook.

mimrepadm

sdbgen

Command used to create the system databanks for Mimer SQL. See SDBGEN - Generating the System Databanks in System Management Handbook.

dbinstall

macOS Link Libraries

Library

Description

libmimcomm.dylib

This is the shared library used when using Mimer JDBC with local communication, i.e. not via TCP/IP.

libmimdbs.dylib

This is the shared library used when accessing the database server in single user mode. It is automatically invoked when a single user access is identified.

libmimer.dylib

This shared library contains several of the client interfaces supported by Mimer SQL, i.e. Embedded SQL and ODBC.

libmimerapi.dylib

This is the shared library for the Mimer SQL C API.

libmimerS.dylib

This is the Mimer setup library used by the unixODBC Driver Manager GUI interface.

libmimmicroapi.dylib

This is the shared library for the Mimer SQL C Micro API.

libmimodbc.dylib

This is the shared library for the Mimer ODBC database interface when the ODBC client is presuming the SQLWCHAR data type being 4 bytes.

libmimsql.dylib

This shared library contains the Mimer SQL database interface used for Embedded SQL client applications.

mimjdbc3.jar

This is the jar file to be used when accessing the Mimer JDBC database interface from a JAVA client using JRE 1.4 or later.

mimsqlxa.o

This object file should be linked in when using the XA functionality.

psmdebug.jar

This is an internal jar file for the PSM Debugger application.