Using a working JDBC connect string for a connect to a remote Oracle database using Oracle JDBC like
jdbc:oracle:thin:@myremotehost:1521:mysid
and mapping it inside SAP Connector with nomenclature
jdbc:oracle:thin:@<virtual host name>:<virtual Port>:mysid
with
<virtual host name> = oracle
<virtual Port>= 61521
resulting in
jdbc:oracle:thin:@oracle:61521:mysid
will end up with error
org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: DataSource returned null from getConnection(): org.ops4j.pax.jdbc.impl.DriverDataSource@45d186af
To check if the issue is related to a problem in the Oracle JDBC Driver we
Installed SAP JDK 8 on the remote database machine
Using Maven to create a standalone Spring-Boot/Spring-JDBC/HikariCP/Oracle JDBC JAR reflecting the stack of SAP Connector / SAP VM using with iFlows
Tested the JAR with connect string successfully
jdbc:oracle:thin:@myremotehost:1521:mysidadd on remote database machine to file /etc/hosts an entry like
oracle XXX.XXX.XXX.XXXwhere XXX.XXX.XXX.XXX is the IP of machine "myremotehost"
Tested the recreated JAR with new connect string successfully
jdbc:oracle:thin:@oracle:1521:mysidReplacing "oracle" as virtual host name by "myoracle" like below fixed the issue with SAP Connector
jdbc:oracle:thin:@myoracle:61521:mysid
According to our finding we think the error is caused inside SAP Connector using Java String.replace() function replacing inside connect string
jdbc:oracle:thin:@oracle:61521:mysid
- Any occurance of "oracle" (virtual host name) by the remote host name "myremotehost"
- Any occurance of "61521" (virtual port number) by the remote host port "1521"
ending up with a connect string like
jdbc:myremotehost:thin:@myremotehost:1521:mysid
which is invalid because the first occurrence of "oracle" in original connect string is required to resolve classes giving the seen error because no connection could be established.
For Developers of the SAP Connector at SAP: Valid workaround in the Java code of SAP Connector would be using regexp or restrict replacement for substring right of at-Sign "@" in connect string so that class resolving is still possible ;-)
kind regards Frank Scherie
Expectation:
SAP fixes the issue and creates a bug/note for the issue