- CDI extension for Oracle UCP
This CDI portable extension provides support for injecting Oracle Universal Connection Pool data sources in your Helidon MicroProfile applications.
Maven Coordinates
To enable Oracle UCP Support add the following dependency to your project’s pom.xml (see Managing Dependencies).
<dependency>
<groupId>io.helidon.integrations.cdi</groupId>
<artifactId>helidon-integrations-cdi-datasource-ucp</artifactId>
</dependency>Injecting an Oracle Universal Connection Pool data source
The following examples show how to create a DataSource named orders in your application.
@Inject
@Named("orders")
private DataSource ordersDataSource; private final DataSource ds;
@Inject
public YourConstructor(@Named("orders") DataSource ds) {
super();
this.ds = ds;
}The extension implements this injection point by creating a PoolDataSource object in the application scope.
You can configure the object using MicroProfile config. For example, the data source created above can be configured as follows:
javax.sql.DataSource.orders.connectionFactoryClassName = oracle.jdbc.pool.OracleDataSource
javax.sql.DataSource.orders.URL = jdbc:oracle:thin:@localhost:1521:ORCL
javax.sql.DataSource.orders.user = sys as sysoper
javax.sql.DataSource.orders.password = OracleProperty names that start with javax.sql.DataSource.dataSourceName. are parsed, and the remaining portion of each name is treated as a Java Bean property of the oracle.ucp.jdbc.PoolDataSource class.