我在尝试连接到系统中配置的timesten DB时遇到此错误:java.sql.SQLException:加载本地库/缺少方法的问题:no ttJdbc1121 in java.library.path
下面是我的代码: 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。有人能帮忙吗?
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);