Using Connection Pooling

Overview of Pooling

Pooling enables you to create a pool of connections to IOM servers. These connections are then shared and reused among multiple client applications. Pooling improves the efficiency of connections between clients and servers because clients use the connections only when they need to process a transaction.
Note: Pooling can be used with SAS Workspace Servers only.
Pooling is most useful for applications that require the use of an IOM server for a short period of time. Because pooling reduces the wait that an application incurs when establishing a connection to SAS, pooling can reduce connection times in environments where one or more client applications make frequent but brief requests for IOM services. For example, pooling is useful for Web applications, such as JavaServer Pages (JSPs).
Pooling is least useful for applications that acquire an IOM server and use the server for a long period of time. A pooled connection does not offer any advantage in applications that use connections for an extended period of time.

Locations for Specifying Pooling Parameters

For Java clients that use an IOM Bridge connection, specify pool parameters in one of the following locations:

Using Pooled Connections

When a request for a connection arrives, the request is handled as follows:
  • If an existing pooled connection is available, then the Java Connection Factory returns that connection.
  • If an existing pooled connection is not available, then the Java Connection Factory creates a new connection.
Users must notify the factory when they are finished with the connection so that it can be returned to the pool or destroyed.
The factory might have a limit on the number of connections it is allowed to create and manage at a time. If a factory has already allocated all of the connections that it can manage and a new connection request arrives, then the factory cannot serve the request immediately. You can specify how long to wait for another user to return a connection to the factory's pool.

Waiting for Connections to Become Available

At the time of a client's request for an object, it is possible that all of the available connections in a connection pool are already allocated to other clients. For example, the Java Connection Factory might not be able to make an additional connection to a server because it would exceed the sasMaxClients value that has been set for the server. In such cases, the client's request cannot be fulfilled until one of the other clients is finished with its object.
To indicate what action you want the Java Connection Factory to take when a request cannot be fulfilled immediately, you can use a long parameter with the getConnection method in the client program. The behavior of the Java Connection Factory depends on the value of the long parameter, as follows:
  • If you specify a positive number, then the Connection Factory attempts to fulfill the request for that number of seconds before returning an exception.
  • If you specify 0, then the Connection Factory attempts to fulfill the request for an unlimited amount of time.
  • If you specify a negative number, then the Connection Factory attempts to fulfill the request once. If the request cannot be fulfilled immediately, then the Connection Factory returns an exception.