Establish an explicit connection in a Windows environment
With an implicit connection, one connection to the database server
can exist for each module
and this connection cannot be shared. An explicit connection allows
multiple connections within a client application. You might want to
design an application that needs to perform multiple connections for
one of the following reasons:
- When you want multiple modules
(either .exe or .dll) to
use the same connection to manipulate database data
Two scenarios in which multiple applications use a single connection to a database server shows scenarios in which multiple applications use the same connection to a database server.
- When you want one module
to create two or more connections to one or more databases, which
includes sharing an ESQL DLL between two C applications
One application that uses connections to more than one database server at the same time shows a single application that establishes connections to multiple database servers.
Two scenarios in which multiple applications
use a single connection to a database server shows the following
two scenarios in which multiple applications share a single connection
to the database server:
- The scenario on the left requires that APP1.EXE establish an explicit connection to the dbserverA database server. After this connection is established, APP1 can pass the connection information required to set the connection in the APP2 DLL.
- The scenario on the right requires that APP3.EXE establish an explicit connection to the dbserverB database server. Both the APP4 and APP5 DLLs can share this connection when APP3 passes the appropriate connection information.
You can also use explicit connections if you want one application
to establish connections to two separate database servers at the same
time, as the following shows.