Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Managing Database Connections


This section describes how users connect to a database and how several simultaneous connections from an application can be handled.

The following SQL statements are used for connection management:

See the Mimer SQL Reference Manual, SQL Statement Descriptions for details.

Selecting a Database

Applications establish database connections with the CONNECT statement, which specifies the database by name.

An application may connect to any of the databases which have been made accessible from the node where the application is running, see Registering the Database. Some applications which are part of the Mimer SQL distribution allow the database name to be specified as a command-line argument.

An application may connect to several databases simultaneously. By using the SQL statement SET CONNECTION the application may switch between active connections. However, a transaction may use only one connection.

The database may be located on the same machine as the application program (a local database), or on a remote machine accessed over a network (a remote database). The network connection is handled by the Mimer SQL software and this is completely transparent to the application program, see Client/Server Interface.

A database is normally accessed by one or more users via the database server. It is also possible for one user to access a local database directly in single-user mode, provided the database server for it is not running and the operating system user has the appropriate access rights to the database files, see Executing in Single-user Mode.

The Default Database

The default database will be used if the CONNECT TO DEFAULT statement is used, or if the database name in the CONNECT statement is specified as an empty string.

The default database can be any of the local or remote databases that are accessible from the node the application program is running on.

The database that is actually selected by a default connection depends on whether a node-specific or user-specific default database is defined at the time the connection is attempted.

Programs supplied as part of the Mimer SQL distribution (e.g. Mimer BSQL) will use the default database when database is not specified on the command line.

Defining a Node-specific Default Database

One default database can be defined for each node in a network.

Win: The default database for a Windows node is defined by using the Mimer Administrator to create a System Wide Mimer ODBC Data Source with the name default and associating it with the selected database.
Refer to the online Windows help provided with the Mimer Administrator for details on how to create System Wide Mimer ODBC Data Sources.

Defining a User-specific Default Database

There may be times when an individual user may wish to override the default database defined for the local machine. This is done by defining a user-specific default database, which will be chosen in preference to the node-specific one.

UNIX + VMS: A user-specific default database is defined under UNIX and OpenVMS by setting the environment variable or logical name called MIMER_DATABASE to be the name of the required local or remote database, as stated in the SQLHOSTS file.
If the MIMER_DATABASE variable is set, all default connections will be made to the database it identifies.
If the MIMER_DATABASE variable is not set, default connections will be made to the node-specific default database for the local machine.

Win: A user-specific default database is defined under Windows by using the Mimer Administrator to create a User Specific Mimer ODBC Data Source with the name default and associating this with a database selected by the user. Refer to the online Windows help provided with the Mimer Administrator for details on how to create User Specific Mimer ODBC Data Sources.
When a User Specific Mimer ODBC Data Source exists with the same name as a System Wide Mimer ODBC Data Source, the user-specific one takes precedence.

Troubleshooting Remote Database Connect Failures

If an attempt to connect to a remote database fails, the client/server connection can be tested by starting Mimer BSQL on the client node and attempting to connect to the database on the server node.

In the event of a connect failure, the following should be checked:

UNIX: Verify that the inetd daemon is listening to the mimer TCP/IP service by using the netstat -a command.

UNIX + VMS: Check that the operating system user has read access to the SQLHOSTS file on the client machine.

UNIX: Check that an operating system user who is trying to use DECNET has TMPMBX and NETMBX privileges enabled.

 ping server_node
 
 telnet server_node 1360

Win: If using NamedPipes, the operating system user must have an account set up on both the local machine and on the machine where the remote database resides. Both accounts must be set up with the same password.
If using NamedPipes to connect a Mimer SQL version 7.3 client to a Mimer SQL database server version 9 (or 8), it will be necessary to take certain steps to enable network communication.
Under version 7.3 the expected Service name was MIMER, but since version 8 the expected Service name is the name of the database.
Therefore, one of the following must be performed before a version 7.3 client can communicate with a version 8 (or later) remote database server:
1) On each version 7.3 client node, the Service parameter in the remote database definition must be changed to be the name of the database instead of the name MIMER.
Or
2) On the version 9 (or 8) server node, start a NamedPipes server which listens to service MIMER so that it can redirect communications to the correctly named database server.
If using NamedPipes to connect a Mimer SQL client version 9 (or 8) to a Mimer SQL version 7.3 database server, the Service parameter in the remote database definition on the client node must be changed to the name MIMER instead of the name of the database.


Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX