Skip Headers

# Acquiring a Client Session That Uses a Named Connection Pool

Previous

Next

Before you can acquire a client session that uses a named connection pool, you must configure your session with a named connection pool. For more information on named connection pools, see "Application-Specific Connection Pools". For more information on creating a named connection pool, see "Internal Connection Pool Creation Overview".

To acquire a client session that uses a named connection pool, use `Server` method `acquireClientSession`, passing in a `ConnectionPolicy` configured with the desired connection pool. The acquired `ClientSession` uses connections from the specified pool for writes (reads still go through the `Server` read connection pool).

Example: Acquiring a Client Session that Uses a Named Connection Pool illustrates how to configure a `ConnectionPolicy` to specify a named connection pool named `myConnectionPool`.

Acquiring a Client Session that Uses a Named Connection Pool

    // Assuming you created a connection pool named "myConnectionPool"
    Session clientSession = server.acquireClientSession(
        new ConnectionPolicy("myConnectionPool")
    );

For more information, see "Configuring Connection Policy".