Camunda 服务器正在启动并且无法启动 jdbc 连接(Oracle DB)

Camunda server starting and cannot initiate jdbc connection (oracle DB)

我有一个 jdbc 到 Oracle 数据库的连接;

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;
}

当 Camunda 服务器启动并尝试获取它抛出的连接时:

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)

即使在“表达式”选项卡 (eclispe) 中,它也向我显示它可以获得连接...但是当我在调试器中检查 DriverManager 时,它会抛出错误并且连接为空...任何人都可以帮忙我?

我在服务器中有 ojdc 驱动程序,我使用 ojdc8 的类路径,我在 SpringBoot 应用程序上使用完全相同的连接,它工作没有任何问题;

谢谢!

问题已解决!

你需要先通过反射获取jdbc驱动程序class,当我启动SpringBoot app时Spring会自动创建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;