Establish an explicit connection in a Windows environment

With an implicit connection, one connection to the database server can exist for each IBM® Informix® ESQL/C 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 Informix ESQL/C modules (either .exe or .dll) to use the same connection to manipulate database data

    Figure 1 shows scenarios in which multiple applications use the same connection to a database server.

  • When you want one Informix ESQL/C module to create two or more connections to one or more databases, which includes sharing an ESQL DLL between two C applications

    Figure 2 shows a single application that establishes connections to multiple database servers.

Figure 1 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

Copyright© 2019 HCL Technologies Limited