我將在java應用程序內部連接到Oracle時間數據庫。爲此我寫了一個簡單的連接類。當我嘗試運行這個java類時出現錯誤「加載本地庫/缺少方法的問題:java.library.path中沒有ttJdbcCS」。我試圖單獨設置LD_LIBRARY_PATH和java.library.path,但問題仍然存在!下面是示例類的源代碼:Oracle時間片內存數據庫的JDBC連接
import java.beans.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.timesten.jdbc.TimesTenConnection;
import com.timesten.jdbc.TimesTenDataSource;
public class TTSimpleConnection {
public static void main(String args[]) {
try {
TimesTenDataSource ttds = new TimesTenDataSource();
ttds.setUrl("jdbc:timesten:client:dsn=temptsn;UID=*****;PWD=*****");
TimesTenConnection ttcon = (TimesTenConnection) ttds
.getConnection();
Statement stmt = (Statement) ttcon.createStatement();
ResultSet rset = ((java.sql.Statement) stmt)
.executeQuery("select * from t");
while (rset.next()) {
System.out.println(rset.getInt(1));
}
} catch (SQLException e) {
e.printStackTrace();
}
}
}
我做了所有提到的解決方案,但沒有人爲我工作。 –