Oracle JDBC (MOSC)

MOSC Banner

When opening a proxy session via JDBC two sessions are displayed in v$session while one is expected.

All Oracle database products.


In a Spring Boot application we use the Universal Connection Pool and its connection labeling functionality to have just one pool of generic connections and to switch later to another schema via OracleConnection.openProxySession().

Before we used the default Spring Boot connection pooling of Hikari but then we needed a pool for each schema, 6 in total.

So to reduce the number of connections we label each connection after its schema when it connects by proxy. The Java PoolDataSource interface has a method registerConnectionLabelingCallback() to initiate this functionality. In the Java ConnectionLabelingCallback interface implementation we have a cost() function that returns 0 (perfect match) if the requested label is equal to the connection label. It will be 1 if there is no session label (connection belongs to generic account) and 2 else (connection belonged to another schema). The configure() method then assigns the correct label and opens a proxy session.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center