0

I'm having an issue that has gone from "annoyance" to "flip the desk".

I have a very basic Spring Boot MVC service with the following Hikari Connection Pool setup:

spring.datasource.username=ME
spring.datasource.password=mypassword
#spring.datasource.url=jdbc:oracle:thin:@SERVICE
spring.datasource.url=jdbc:oracle:thin:@localhost:1521/SERVICE
# need the duplicate because hikari is "special", but it's the spring default
#spring.datasource.jdbc-url=jdbc:oracle:thin:@SERVICE
spring.datasource.jdbc-url=jdbc:oracle:thin:@localhost:1521/SERVICE

# HikariCP settings
spring.datasource.hikari.minimumIdle=5
spring.datasource.hikari.maximumPoolSize=5
spring.datasource.hikari.idleTimeout=30000
spring.datasource.hikari.maxLifetime=2000000
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.poolName=HikariPool
# leak detection - 30 seconds/30k ms
spring.datasource.hikari.leak-detection-threshold=30000

It seems that a connection is being held. I've tried restarting my Oracle Service and Listener with no luck, and the only solution seems to be to reboot.

Can anyone assist?

Update: I removed Hikari and used this:

spring.datasource.type=org.springframework.jdbc.datasource.SimpleDriverDataSource

I no longer think this is directly related to Hikari.

Edit 2:

Here's the actual "caused by" root exception:

Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
  (CONNECTION_ID=Z0U0SUlgTNuHsXgisq9YSA==)
    at oracle.net.ns.NSProtocolNIO.createRefusePacketException(NSProtocolNIO.java:816) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    at oracle.net.ns.NSProtocolNIO.handleConnectPacketResponse(NSProtocolNIO.java:396) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    at oracle.net.ns.NSProtocolNIO.negotiateConnection(NSProtocolNIO.java:207) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:350) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:2372) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:657) ~[ojdbc8-21.5.0.0.jar:21.5.0.0.0]
    ... 85 common frames omitted

That particular CONNECTION_ID is randomized and different each time.

Jason
  • 3,943
  • 12
  • 64
  • 104
  • Try configuring with the "long form": https://stackoverflow.com/questions/43884504/jdbc-thin-connection-string-in-oracle-uses-both-colon-and-forward-slash – pringi Sep 06 '22 at 12:47
  • Is your database service exposed/registered with the listener? lsnrctl status | grep SERVICE – Bjarte Brandt Sep 06 '22 at 14:18
  • @pringi did not help – Jason Sep 06 '22 at 15:04
  • @BjarteBrandt yes it is. ```Service "SERVICE" has 1 instance(s)``` – Jason Sep 06 '22 at 15:05
  • Well, make sure you can connect using sqlplus or sqlcl before continuing with Hikari. sqlplus user/password@localhost:1521/SERVICE .... Try giving the service_name another name. Not sure if "SERVICE" is a valid name... You might also try "jdbc:oracle:thin:@\\localhost:1521/SERVICE". – Bjarte Brandt Sep 06 '22 at 18:38
  • Typo. Two forslashes instead of backslashes: "jdbc:oracle:thin:@//localhost:1521/SERVICE" – Bjarte Brandt Sep 06 '22 at 18:45
  • SERVICE is a sanitized version of the actual service name. – Jason Sep 07 '22 at 17:24

0 Answers0