I am trying to configure Oracle UCP to work in my Spring Boot 1.2.7 application, with Hibernate. I currently have c3p0 working, but I need to to support Oracle RAC.
I realize that Oracle UCP is not directly supported by Hibernate, but this document from Oracle seems to say I can use it:
https://blogs.oracle.com/dev2dev/entry/how_to_use_oracle_universal
Also, I have found a number of older examples that demonstrate how to to make a Bean and / or configure with XML, but I currently have no XML configuration. Also, I think Spring, at this point, can do this all from application.properties file and the pom.
In my pom, for Oracle, I have:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.1</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ons</artifactId>
<version>12.1.0.2</version>
</dependency>
For Hibernate I have:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>4.3.11.Final</version>
</dependency>
I realize I can remove the c3p0 dependancy.
What I'm confused about is what properties to specify. I think I need these:
spring.datasource.driverClassName=oracle.jdbc.pool.OracleDataSource
spring.jpa.database-platform=org.hibernate.dialect.Oracle10gDialect
spring.jpa.properties.hibernate.connection.driver_class = oracle.jdbc.pool.OracleDataSource
spring.datasource.url=jdbc:oracle:thin:@mydb.mycomp.com:1521:abcde
spring.datasource.username=user
spring.datasource.password=pass
spring.jpa.properties.hibernate.connection.username=user
spring.jpa.properties.hibernate.connection.password=pass
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
spring.jpa.properties.hibernate.connection.provider_class = oracle.jdbc.pool.OracleDataSource
spring.datasource.maxPoolSize = 10
spring.datasource.initialPoolSize = 5
When I fire this up, I get:
java.sql.SQLException: oracle.jdbc.pool.OracleDataSource cannot be cast to java.sql.Driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:280)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:200)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:708)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:642)
at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:464)
at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:141)
If someone could let me know the proper properties or point me to current docs I would greatly appreciate it, thanks!