Oracle连接运行时错误.请帮忙. [英] Oracle Connection Runtime Error. Please give a hand.
本文介绍了Oracle连接运行时错误.请帮忙.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在参加毕业设计.我工作超过1个月.我为此花了太多时间.但是它有问题.我无法连接到数据库.这是我的代码.当我运行应用程序时,netbeans给出错误.
Hello everyone,
I am on my graduation project. I am working more than 1 month. I have spent too much time for this. But It has problems. I can not connect to database. Here is my code. When I run application netbeans give errors.
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
try (Connection conn = DriverManager.getConnection("jdbc:oracle:oci8:@O10G", "plsql_staj", "plsql_staj1");
Statement st = conn.createStatement()) {
ResultSet rs = st.executeQuery("SELECT * from E_USER");
rs.close();
}
} catch (SQLException ex) {
Logger.getLogger(AddNewUser.class.getName()).log(Level.SEVERE, null, ex);
}
当我跑步时,会显示此错误消息.
When I got a run I take this error message.
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
我下载了ocijdbc9.dll
和ocijdbc.jar
我不知道将这些文件放在哪里.
这对我来说非常非常重要.请帮忙.
I downloaded ocijdbc9.dll
and ocijdbc.jar
I have no idea where to put these files.
That is very very very important for me. Please give a hand.
推荐答案
这些文件需要添加到Java主库目录中,或添加到单独的目录中,其名称包含在PATH
中.环境变量,或作为Java调用的选项包含在内,因此:
These files need to be added to your main Java library directory or added to a separate directory, whose name is included in thePATH
environment variable, or included as an option on the java call thus:
java -Djava.library.path=C:\MyLibrary MyClass
这篇关于Oracle连接运行时错误.请帮忙.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文