Oracle Universal Connection Pool (UCP) is a feature-rich connection pool that provides a seamless integration with Oracle Real Application Clusters (RAC), Active Data Guard (ADG), Global Data Services (GDS) providing in-built support for high availability, scalability, and performance features. With older releases of Spring Boot, an additional bean class was required to use UCP as a datasource. Now, with SpringBoot v2.4.0 and later, it is easier to configure UCP without any extra code. Spring identifies UCP as a datasource like any other datasource from application.properties. Follow these steps to see UCP in action.
#1: Download a sample Spring Application from Github.
#2: Make sure you are using latest Spring-Boot version. Check this in pom.xml
#3: Specify UCP as a datasource in application.properties. You can set other UCP properties as required. Make sure to update the database URL, username, and password to point to your database.
#4: Compile and run OracldJdbcApplication.java to verify the connection to the database. The output looks as shown below.
#5:Create a new user testuser along with EMP and DEPT tables using JDBCSampleData.java and test out other functionalities of listing all employees and inserting a new employee.
Other Resources:
Configuring the Oracle JDBC drivers in a SpringBoot project - Take 2
Oracle Connection Pooling with Spring
My name is Nirmala Sundarappa. I am the Product Manager for Oracle Java Database Connectivity (JDBC) driver and Universal Connection Pool (UCP) used with Oracle Database.