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
CONNECTstatement, 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.
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 DEFAULTstatement is used, or if the database name in the
CONNECTstatement 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.
Linux + VMS: The default database for Linux and OpenVMS nodes is defined by specifying the name of the database in the
DEFAULTsection of the
SQLHOSTSfile, see The SQLHOSTS File on VMS and Linux.
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
defaultand associating it with the selected database.Refer to the 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.
Linux + VMS: A user-specific default database is defined under Linux and OpenVMS by setting the environment variable or logical name called
MIMER_DATABASEto be the name of the required local or remote database, as stated in the
MIMER_DATABASEvariable is set, all default connections will be made to the database it identifies.If the
MIMER_DATABASEvariable 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
defaultand associating this with a database selected by the user. Refer to the 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:
- If the connect was attempting to access the default database, check that a user-specific or node-specific default database is correctly defined on the client node, see The Default Database for details on how this is done.
- Check that the database been correctly set up as a local database on the server node, see The Local Database, and as a remote database on the client node, see Accessing a Database Remotely, and that the name of the remote database is the same as that of the local database.
Linux: Verify that the
inetddaemon is listening to the mimer TCP/IP service by using the
- Check that the operating system user who is trying to establish the connection can access all required files etc. on the client node.
Linux + VMS: Check that the operating system user has read access to the
SQLHOSTSfile on the client machine.
- Check that the operating system user who is trying to establish the connection has all the required operating system privileges
VMS: Check that an operating system user who is trying to use DECNET has
- If the TCP/IP protocol is being used, check that the server node is reachable from the client node over the network by using the
- If the TCP/IP protocol is being used, try to telnet to the TCP/IP port. You should get a connection and when
<CR>is entered, the connection should be closed by the server: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
NamedPipesto connect a Mimer SQL version 7.3 client to a Mimer SQL database server version 8 or later, 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 newer 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.Or2) On the server node, start a
NamedPipesserver which listens to service
MIMERso that it can redirect communications to the correctly named database server.If using
NamedPipesto connect a Mimer SQL client version 8 or later 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
MIMERinstead of the name of the database.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40