javaoracle-databasespring-boottnsoracle-autonomous-db

Cannot Connect to Oracle Autonomous Database using Springboot and TNS wallet


I have a Autonomous database which I want to connect via Springboot but I am facing the following error even when ACL is turned off on Oracle Database.

java.sql.SQLException: Listener refused the connection with the following error:
ORA-12506, TNS:listener rejected connection based on service ACL filtering

My application.properties look like this -

spring.application.name=hr_data
database=oracle
spring.datasource.url=jdbc:oracle:thin:@(description= (retry_count=1)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-mumbai-1.oraclecloud.com))(connect_data=(service_name=123_mydb_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))?TNS_ADMIN=F:/Downloads/Wallet_myDB
spring.datasource.username=ADMIN123
spring.datasource.password=123
spring.jpa.database-platform=org.hibernate.dialect.Oracle12cDialect
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
#logging.level.org.springframework=DEBUG
oracle.net.tns_admin=F:/Downloads/Wallet_myDB

I am able to connect to the DB using SQL Developer studio using the Wallet which I have downloaded.

Things I have tried :-

  1. Turning on Access control list in oracle and adding my IP - doesn't work
  2. Trying various combination of TNS_ADMIN on connection string and oracle.net.tns_admin - doesn't work
  3. Trying to connect via manual @Configuration class - doesn't work.
  4. F:\Downloads\Wallet_myDB, F:/Downloads/Wallet_myDB -nope

Now I am scratching my head what else is remaining or is there some misconfiguration from my end? Any help is appreciated

ISSUE RESOLVED The application properties should look like this-

spring.datasource.url=jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-mumbai-1.oraclecloud.com))(connect_data=(service_name=abv_mydb_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))
TNS_ADMIN=F:/Downloads/Wallet_myDB
spring.datasource.username=ADMIN123
spring.datasource.password=123

Blockquote


Solution

  • ISSUE RESOLVED The application properties should look like this-

    spring.datasource.url=jdbc:oracle:thin:@(description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.ap-mumbai-1.oraclecloud.com))(connect_data=(service_name=abv_mydb_high.adb.oraclecloud.com))(security=(ssl_server_dn_match=yes)))
    TNS_ADMIN=F:/Downloads/Wallet_myDB
    spring.datasource.username=ADMIN123
    spring.datasource.password=123