When working with Hibernate
and Oracle DB with Wallet.
Getting below error:
org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl HHH000115: Hibernate connection pool size: 20 (min=1)
I am trying currently with
Java/JDK: 17
Hibernate: 'org.hibernate:hibernate-core:5.4.27.Final'
Oracle Autonomous DB: 19c connection via wallet.
I tried with different version of JDK(8 and 11) and Hibernate(5.3.xx, 6.4.xx, 5.2.xx). Same error everytime.
CodePudding user response:
The issue in my case was because of proxy setting. As I was connecting through Oracle's OCI Autonomous Database Wallet.
I tried setting proxy using System
class. Something like below:
System.setProperty("https.proxyHost", "<proxy host>");
System.setProperty("https.proxyPort", "80");
System.setProperty("http.proxyHost", "<proxy host>");
System.setProperty("http.proxyPort", "80");
That didn't work.
So, I used proxy directly on my wallet. I provided path of Wallet in my persistence.xml
as shown:
<property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@db_high?TNS_ADMIN=Absolute path of DB Wallet"/>
<property name="javax.persistence.jdbc.user" value="TEST"/>
<property name="javax.persistence.jdbc.password" value="db123"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle12cDialect" />
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
<property name="hibernate.jdbc.use_get_generated_keys" value="true" />
<property name="hibernate.jdbc.use_scrollable_resultset" value="true" />
<property name="spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults" value="false" />
<property name="hibernate.jdbc.batch_size" value="1000" />
<property name="hibernate.jdbc.batch_versioned_data" value="true" />
<property name="hibernate.order_inserts" value="true" />
<property name="hibernate.order_updates" value="true" />
<property name="hibernate.cache.use_second_level_cache" value="false" />
<property name="hibernate.connection.autocommit" value="false" />
<property name="hibernate.show_sql" value="false" />
<property name="hibernate.generate_statistics" value="false" />
<property name="hibernate.use_sql_comments" value="false" />
As the alias
is db_high
here, so apply proxy as shown below in tnsnames.ora
inside the WALLET_DB
directory.
db_high = (description= (retry_count=20)(retry_delay=3)(address=(https_proxy=PROXY-URL)(https_proxy_port=PROXY_PORT)(protocol=tcps)(port=1522)(host=HOST))(connect_data=(service_name=SERVICE-HOST))(security=(ssl_server_cert_dn="CN=SOME-HOST, OU=Oracle BMCS US, O=Corporation, L=CITYNAME, ST=California, C=US")))
Please note the https_proxy
and https_proxy_port
here.