Connects a user ident to a database.
The ident is logged into the specified database. The database can exist on the local machine, a local database, or on another machine in a network configuration, a remote database.
passwordcan be supplied either using a host variable or as a literal value.
If an empty string is specified for
database, a connection is established to the
DEFAULTdatabase, see the Mimer SQL System Management Handbook, The Default Database, for details on how the
DEFAULTdatabase is defined in the Mimer SQL system.
identis not specified (or
identis specified as blank), the name of the current operating system user is assumed. In that case, if an
OS_USERident with that name exists in the selected database, a connect will be established without any password verification.
Note: It is only possible to establish a connection to a remote database without specifying ident (or specifying a blank ident) if both the node on which the database resides and the node from which the connection is attempted are running the Windows operating system, and the NamedPipes protocol is used for the network communication.
It is not possible for the database server node to determine the name of the operating system user currently using the remote machine in other network configurations.
When connected, the ident is able to access the database and becomes the current ident (i.e. the name the returned by
connectionis specified, the name must be a valid identifier or an empty string.
Note: Connection names must be unique. If an empty string is specified, or if no connection name is given, the value of database will be used as the connection name.
connectionare case sensitive in the
Databaseis not case sensitive in the
See SQL Identifiers for more information.
Only idents of type
OS_USERcan connect to a database using the
If it is desired that a
CONNECT TO DEFAULTbe effectively performed, but with the possibility of specifying one or more of
password, then specify
database-specificsbut supply an empty string for
The maximum length of
connectionis 128 characters.
The maximum length of
passwordis 18 characters.
If an SQL statement is executed in an application without first executing a
CONNECTstatement, an implicit
CONNECT TO DEFAULTis performed.
This requires that an
OS_USERident exist in the default database with the same name as the operating system user and that the default database either be a local database or a remote database residing on a node which allows the name of the current operating system user to be determined - see the related note in the Description section above for details.
Such an implicit default connection will only be established if the
CONNECTstatement has not been previously executed in the application. This means that if an explicit connection has been previously established and then disconnected, any subsequent attempt to execute an SQL statement without a current connection will result in either a
Connection does not existerror or a transaction rollback depending on the context of the SQL statement.
If only the implicit default connection has been previously established and then disconnected, any subsequent attempt to execute an SQL statement without a current connection will result in that connection being re-established.
Observe that it is possible for the implicit default connection to exist but not be currently active (this will be the case if a connection has been subsequently established and then disconnected).
We recommend that Mimer SQL applications always establish explicit connections and reliance on the implicit default connection is discouraged.
Earlier versions of Mimer SQL used a different syntax for the
CONNECTstatement, see Deprecated Features. This syntax is still supported for backward compatibility, but its use is not recommended in new applications.
The following example connects the user
proddatabaseusing the password
hopPsan7:CONNECT TO 'proddatabase' USER 'JOE' USING 'hopPsan7';
For more information, see the Mimer SQL User's Manual, Managing Database Connections.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40