Skip to main content
Version: 2.0.4

Universal Connection Pool

The UCP starter provides an Oracle AI Database DataSource backed by Universal Connection Pool.

Dependency Coordinates​

<dependency>
<groupId>com.oracle.database.spring</groupId>
<artifactId>oracle-spring-boot-starter-ucp</artifactId>
</dependency>

Configuring the Data Source​

Configure spring.datasource in application.yaml and add Spring Data JDBC or Spring Data JPA as needed:

spring:
datasource:
url: jdbc:oracle:thin:@//myhost:1521/pdb1
username: ${USERNAME}
password: ${PASSWORD}
driver-class-name: oracle.jdbc.OracleDriver
type: oracle.ucp.jdbc.PoolDataSourceImpl
oracleucp: # Any UCP specific connection parameters defined here
connection-factory-class-name: oracle.jdbc.pool.OracleDataSource
connection-pool-name: AccountConnectionPool
initial-pool-size: 15
min-pool-size: 10
max-pool-size: 30

The oracleucp block is optional and can be used to fine-tune the pool configuration with Oracle UCP specific properties.

Micrometer Metrics​

Spring Boot publishes generic jdbc.connections.* metrics for UCP when Actuator is enabled. To export UCP-specific runtime statistics as well, add the Spring Boot Actuator and UCP Micrometer dependencies to your project:

<dependency>
<groupId>com.oracle.database.spring</groupId>
<artifactId>oracle-spring-boot-ucp-micrometer</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

The module automatically binds every UCP PoolDataSource to the available Micrometer registry. Portable pool-state meters are aligned with OpenTelemetry database client metric conventions:

MeterUCP valueAttributes
db.client.connection.countAvailable connectionsdb.client.connection.pool.name, db.client.connection.state=idle
db.client.connection.countBorrowed connectionsdb.client.connection.pool.name, db.client.connection.state=used
db.client.connection.maxMaximum pool sizedb.client.connection.pool.name
db.client.connection.idle.minMinimum idle connections, when supported by UCPdb.client.connection.pool.name
db.client.connection.pending_requestsPending connection requestsdb.client.connection.pool.name

The pool-name attribute uses a nonblank UCP connection-pool name when configured. Otherwise, it uses the Spring DataSource bean name, which keeps auto-configured pools unique within the application. The count, maximum, and minimum meters use the Micrometer connections base unit; pending requests use requests.

Additional Oracle UCP statistics are provided under the ucp.connections namespace:

Meter or groupMeaning
ucp.connections, .min, .capacity, .peakTotal connections, minimum pool size, remaining capacity, and peak connections
ucp.connections.active.average, .active.peakAverage and peak borrowed connections
ucp.connections.labeled, .abandonedLabeled connections and abandoned connections reclaimed
ucp.connections.created, .closedCurrent-pool creation and closure values, which may reset when the pool restarts
ucp.connections.borrowed, .returned, .creation.attemptsCumulative function counters
ucp.connections.acquire.average, .acquire.peakConnection-acquire time gauges
ucp.connections.acquire, .acquire.failed, .acquire.total, .usageFunction timers backed by cumulative counts and total times

Shard-specific statistics are not exported because shard names can produce unbounded metric-tag cardinality.