0

我在尝试连接到系统中配置的 timesten DB 时遇到此错误:java.sql.SQLException:加载本机库/缺少方法时出现问题:java.library.path 中没有 ttJdbc1121

这是我的代码:

    try {
        Class.forName("com.timesten.jdbc.TimesTenDriver");
        conn = DriverManager
                .getConnection("jdbc:timesten:direct:dsn=TT_Alias");
        System.out.println(conn);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    finally {
        try {
            if(conn != null) {
                conn.close();
            }
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

我在构建路径中使用 java 5 并附加了 ttjdbc5.jar。有人可以帮忙吗?

4

1 回答 1

0
ttJdbcCS1122.dll is in bin folder of TimesTen home please copy that to lib folder, now start running you program it will work if rest of configuration is correct.



// /JDBC Driver
static final String JDBC_DRIVER = “com.timesten.jdbc.TimesTenDriver”;
static final String DB_URL = “jdbc:timesten:client:TTC_Server=serverIp;TTC_Server_DSN=DSN;TCP_PORT=PortNo”;

// DB Credential
static final String username = “***”;
static final String password = “****”;

System.out.println(“Registering database …”);
Class.forName(JDBC_DRIVER);

//Connecting to db
System.out.println(“Connecting to database …”);
conn = DriverManager.getConnection(DB_URL, username, password);
于 2018-01-05T10:53:50.797 回答