2
votes

I have a jdbc connection to a oracle DB;

if(connection == null || connection.isClosed()) {
    try {
        connection = null;
        connection = DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/ORCL", "usr", "pass");
} catch(Exception e) {
    e.printStackTrace();
    throw e;
}

When the Camunda server starts and tries to get the connection it throws:

java.sql.SQLRecoverableException: IO Error: Invalid number format for port number at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:774) at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:688) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:39) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:691) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source)

Even tho in the Expressions tab (eclispe) it shows me that it can get the connection... but when i go over the DriverManager in debugger it throws the error and the connection is null... Can anybody help me?

I have the ojdc driver in the server and the classpath i use ojdc8 and i use the exact same connection on a SpringBoot app and it works without any problems;

Thanks!

1
Try: "jdbc:oracle:thin:@//localhost:1521:ORCL"access_granted
It throws the same exception: java.sql.SQLRecoverableException: IO Error: Invalid number format for port numberClaude
try it with jdbc:oracle:thin:@localhost:1521:ORCLwatchme
Another format you can try is: "jdbc:oracle:thin:@(description=(address_list=(address=(protocol=tcp)(port=1521)(host=localhost)))(connect_data=(SID=ORCL)))"access_granted
Please post your solution as an answer of its own, not as an edit.Cœur

1 Answers

0
votes

Problem solved!

You need to get the jdbc driver class through reflection first, when i start the SpringBoot app Spring automatically creates the class

  if(connection == null || connection.isClosed()) {
        try {
            connection = null;
            Class.forName("oracle.jdbc.driver.OracleDriver");
            connection = DriverManager.getConnection("jdbc:oracle:thin:@//localhost:1521/ORCL","usr","pass");
        }
        catch(Exception e) {
            e.printStackTrace();
            throw e;
        }
    }
    return connection;