Show TOC

Procedure documentationConnection Pools Locate this document in the navigation structure


If you use generic user names to log on to the SAP server (which is normally the case for Web server applications), it is advisable to use connection pools because all connections in a pool contain the same system, user, and client information. Connection Pools have two distinct advantages compared with direct connections:

  • You avoid overhead when logging on to SAP because the connection remains open and can be reused as soon as one successful logon has taken place.

  • You can restrict the maximum number of concurrent logons and thus avoid consuming too many SAP system resources.

Note Note

Select an appropriate maximum number of concurrent logons to avoid user wait times result.

End of the note.

Note Note

Optimal use of connection pools is achieved if all pools use the same user ID. However, because the authorizations in SAP are linked to the user, this situation is only realistic if certain prerequisites are fulfilled (for example, if no security-relevant areas are affected).

End of the note.

The example coding below lists the connection attributes exactly as in the section Direct Connections , except that in this case, connection pools are used. For the complete example program for establishing a connection pool, see:

  1. First, you need the following specific classes:

    • JCO.Pool: This class represents a connection pool

    • JCO.PoolManager: All connection pools within a Java Virtual Machine (JVM) are administrated here.

  2. Choose a pool name. In SAP JCo, you can use pool names of your choice. However, because pools are valid globally within a JVM, you should use a specific naming standard if different applications are running on the same JVM.

  3. The global JCO.PoolManager object administrates all pools and can be called using the method getClientPoolManager() of the class JCO. The method getPool() attempts to call a particular pool (name). If no pool exists with the specified name (return value null), a new pool is created.

Syntax Syntax




Defining a Pool Name

static final String POOL_NAME = "Pool";

Does the pool exist already?

JCO.Pool pool = JCO.getClientPoolManager ().getPool (POOL_NAME);

if (pool == null) {

End of the code.
More Information

For information on further procedures, see:

The complete example program for creating a connection pool: