Supporting multiplexed connections

A multiplexed connection uses a single network connection between the database server and a client to handle multiple database connections from the client.

About this task

Client applications can establish multiple connections to a database server to access more than one database on behalf of a single user. If the connections are not multiplexed, each database connection establishes a separate network connection to the database server. Each additional network connection uses additional computer memory and processor time, even for connections that are not active. Multiplexed connections enable the database server to create multiple database connections without using up the additional computer resources that are required for additional network connections.

To configure the database server to support multiplexed connections:

Procedure

  1. Define an alias using the DBSERVERALIASES configuration parameter.
    For example, specify:
    DBSERVERALIASES ifx_mux
  2. Add an sqlhosts file entry for the alias using onsqlmux as the nettype entry. The hostname and servicename, must have entries, but the entries are ignored. Dashes (-) can be used as entries.
    For example:
    #dbservername   nettype    hostname   servicename   options
    ifx_mux         onsqlmux   -          -
  3. Enable multiplexing for the selected connection types by specifying m=1 in the sqlhosts entry that the client uses for the database server connection.
    For example:
    #dbservername   nettype    hostname   servicename   options
    menlo           ontlitcp   valley     jfkl          m=1
  4. On Windows™ platforms, you must also set the IFX_SESSION_MUX environment variable.

Example

The following example shows both onconfig file and sqlhosts file entries.

onconfig file:

DBSERVERNAME web_tli
DBSERVERALIASES web_mux
sqlhosts file:
#dbservername   nettype    hostname   servicename   options
web_tli         ontlitcp   node5      svc5          m=1
web_mux         onsqlmux   -          -

You are not required to change the sqlhosts information that the database server uses. The client program does not require any special SQL calls to enable connections multiplexing. Connection multiplexing is enabled automatically when the onconfig file and the sqlhosts entries are configured appropriately and the database server starts.

Multiplexed connections do not support:
  • Multithreaded client connections
  • Shared-memory connections
  • Connections to subordinate database servers (for distributed queries or data replication, for example)
If any of these conditions exist when an application attempts to establish a connection, the database server establishes a standard connection. The database server does not return an SQL error.

The sqlbreak() function is not supported during a multiplexed connection.