Oracle_ojdbc6 使用 报错

本文解决了一种常见的Java应用执行错误:在使用java命令执行包含Oracle数据库连接的测试类时,出现'ORA-01005: null password given; logon denied'的SQL错误。解决方案涉及添加特定的JAR包到类路径中。

via: http://sd8089730.iteye.com/blog/1574884

 

执行java应用 java -Djava.ext.dirs=./lib -classpath classes test.Test

报错,但配置文件都正确

java.sql.SQLException: ORA-01005: null password given; logon denied  

  

        at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.ja  

va:70)  

        at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:1  

12)  

        at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java  

:173)  

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)  

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406)  

        at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:399)  

        at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthentica  

te.java:794)  

        at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:391)  

        at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:  

490)  

        at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)  

        at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio  

n.java:33)  

        at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)  

        at java.sql.DriverManager.getConnection(Unknown Source)  

        at java.sql.DriverManager.getConnection(Unknown Source)  

 

        at test.Test.main(Test.java:18) 

 

解决方法  添加 jar包sunjce_provider.jar (which is in the JDK_DIR/jre/lib/ext folder).

Oracle Database 12c Release 1 (12.1.0.1) JDBC Drivers SimpleFAN Download simplefan.jar (21,048 bytes) - Classes for subscribing to RAC events via ONS; simplefan policy and javadoc JDBC Thin for All Platforms Download demo.tar (686,080 bytes) - JDBC Demos (TAR format) Download demo.zip (614,561 bytes) -JDBC Demos (ZIP format) Download JavaDoc (7,103,997 bytes) Download README Download ojdbc6.jar (3,389,454 bytes) - For use with JDK 6; It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types. Download ojdbc6_g.jar (5,382,573 bytes) - Same as ojdbc6.jar except compiled with "javac -g" and contains tracing code. Download ojdbc6dms.jar (4,033,913 bytes) - Same as ojdbc6.jar, except that it contains instrumentation to support DMS and limited java.util.logging calls. Download ojdbc6dms_g.jar (5,405,632 bytes) - Same as ojdbc6_g.jar except that it contains instrumentation to support DMS. Download ojdbc7.jar (3,397,734 bytes) - For use with JDK 7; It contains the JDBC driver classes except classes for NLS support in Oracle Object and Collection types. Download ojdbc7_g.jar (5,395,834 bytes) - Same as ojdbc7.jar except compiled with "javac -g" and contains tracing code. Download ojdbc7dms.jar (4,044,963 bytes) - Same as ojdbc7.jar, except that it contains instrumentation to support DMS and limited java.util.logging calls. Download ojdbc7dms_g.jar (5,419,088 bytes) - Same as ojdbc7_g.jar except that it contains instrumentation to support DMS. Download orai18n.jar (1,659,576 bytes) - Classes for NLS support Download xdb6.jar (263,690 bytes) - Classes to support standard JDBC 4.x java.sql.SQLXML interface (Java SE 6 & Java SE 7). 附件里的文件都可以在这里下载,只是不用再注册用户了: http://www.oracle.com/technetwork/database/features/jdbc/jdbc-drivers-12c-download-1958347.html
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值