The implicit Connection
- The DATABASE statement creates an implicit connection to a database environment and opens the specified database.
- The CREATE DATABASE statement creates an implicit connection and creates a database.
- The DROP DATABASE statement creates an implicit connection and drops (removes) the specified database.
- A single-statement PREPARE of one of the preceding statements also establishes an implicit connection.
When you execute one of the preceding statements, the application first connects to the default database server (that the INFORMIXSERVER environment variable indicates). The default database server parses the database statement. If the statement specifies the name of a database server, the application then connects to the specified database server. To establish an implicit connection to a specified database server, an application must therefore connect to two database servers. An explicit connection only requires a connection to a single database server, and therefore involves less overhead.
If an implicit connection exists, these database statements close it before they establish the new connection. The new implicit connection remains open after the SQL statement completes. This behavior contrasts with explicit connections, which allow multiple connections to the same or to a different database environment.
The CLOSE DATABASE statement closes the database and, in applications before version 6.0, also closes the implicit connection to the database. If you precede these statements with a CONNECT, each can also operate in the context of the current explicit connection.
Use of an implicit connection provides a smooth migration path for older applications into the connection-oriented environment that CONNECT, DISCONNECT, and SET CONNECTION statements support. For more information about implicit connections, see the CONNECT statement in the HCL OneDB™ Guide to SQL: Syntax.