Cannot access external oracle database from springboot app running within container

I have a springboot server application which accesses an oracle database. While running in my Linux environment there is no issue. However, when starting theapplication from within a docker container, it is failing to reach the database with the error below. Is there something special that needs to be configure?

below is database specific properties…
spring.datasource.platform=oracle
#spring.datasource.url=jdbc:oracle:thin:@//tml-uat-scan.nam.nsroot.net:15210/TMLU2
spring.datasource.url=jdbc:oracle:thin:@tml-uat-scan.nam.nsroot.net:15210/TMLU2
spring.datasource.username=xxxx
spring.datasource.password=xxxx
spring.jpa.database-platform = org.hibernate.dialect.Oracle10gDialect
spring.datasource.driver-class-name = oracle.jdbc.OracleDriver

ERROR from log…
2020-02-12 19:03:58.877 INFO 1 — [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting…
2020-02-12 19:05:30.242 ERROR 1 — [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.

2020-02-12 19:05:30.247 WARN 1 — [ main] o.s.b.a.orm.jpa.DatabaseLookup : Unable to determine jdbc url from datasource

org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:328) ~[spring-jdbc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
at org.springframework.jdbc.support.JdbcUtils.extractDatabaseMetaData(JdbcUtils.java:356) ~[spring-jdbc-5.0.9.RELEASE.jar!/:5.0.9.RELEASE]
at org.springframework.boot.autoconfigure.orm.jpa.DatabaseLookup.getDatabase(DatabaseLookup.java:72) ~[spring-boot-autoconfigure-2.0.5.RELEASE.jar!/:2.0.5.RELEASE]

Hi We had fun (not) with connecting to oracle from container. May not be the same issue as the application gave poor error messages but in the end fixed it by setting SQLNET.EXPIRE_TIME = 10 in the sqlnet.ora file on the server.

Good luck

Were you able to resolve your issue? I am experiencing the same problem and have been able to limit it down to a problem with docker being able to connect using the SCAN listener. If I connect directly to one of the oracle cluster nodes the connection works.