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:
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.
    Figure 1: Two scenarios in which multiple applications use a single connection to a database server


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.
Figure 2: One application that uses connections to more than one database server at the same time