ORA-01005: null password given; logon denied
ORA-01005: null password given; logon denied
最近在測試JDBC連接Oracle數據庫兼容密碼包含特殊字符的問題時,出現了java.sql.SQLException: ORA-01005: null password given; logon denied的報錯,嘗試了各種Debug調試,確認程序完全沒有問題,在本機測試也沒問題,數據庫驅動(官網下載的對應數據庫版本的驅動)和JDK版本(都是Oracle JDK 1.8)兩邊環境也一樣,但部署到應用環境上就是報錯,翻遍了各種帖子也沒解決,最后偶然看到了一個回復,嘗試了下果然好了
具體報錯信息如下:
java.sql.SQLException: ORA-01005: null password given; logon deniedat oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:628)at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:557)at oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:552)at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:1312)at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:699)at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:726)at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:291)at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:389)at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTHWithO5Logon(T4CTTIoauthenticate.java:1455)at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1219)at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:1173)at oracle.jdbc.driver.T4CConnection.authenticateUserForLogon(T4CConnection.java:1030)at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:646)at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:1032)at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:90)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:681)at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:602)at java.sql.DriverManager.getConnection(DriverManager.java:664)at java.sql.DriverManager.getConnection(DriverManager.java:247)at com.adtec.moia.control.agent.util.MoiaUtil.getConnection(MoiaUtil.java:195)at com.adtec.moia.control.agent.deal.dbsjob.DbsJobExecutor.execute(DbsJobExecutor.java:70)at com.adtec.moia.control.agent.deal.JobExecuteThread.run(JobExecuteThread.java:99)at java.lang.Thread.run(Thread.java:748)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at java.lang.Thread.run(Thread.java:748)最后在Bing國際版的搜索中找到了下面的參考信息:
意思就是讓換下驅動嘗試下
java.sql.SQLException: ORA-01005: null password given; logon denied - Java - JDBC Archive (databaseusers.com)
java.sql.SQLException: ORA-01005: null password given; logon denied
Hello! I'm getting this exception while trying to establish a JDBC connection to an Oracle database (10g Express Edition): java.sql.SQLException: ORA-01005: null password given; logon denied The code is the following:try { OracleDataSource ods = new OracleDataSource(); ods.setDriverType("thin"); ods.setPassword("rafael"); ods.setUser("rafael"); ods.setDatabaseName("XE"); ods.setPortNumber(1521); ods.setServerName("iceman"); Connection c = ods.getConnection(); } catch (SQLException e) { e.printStackTrace(); }I'm also getting the same exception while running this code:Connection c = DriverManager.getConnection("jdbc:oracle:thin:#iceman:1521:XE", "rafael", "rafael");An interesting fact is DbVisualizer is successfully connecting to this database using exactly the above url. You can see the screen captured here: http://db.tt/YKxQCvf Anyone can help me to bypass this problem? Thanks in advance Edited by: user13275297 on 22/06/2011 13:14 This could be the jar issue, post the jdk version and jar you are using to establish the db connection. if you are not using ojdbc14.jar, then you can make a try with this jar. also go through the below post, it might help you: Login failure using Oracle Express 10.2, Java 6 and ojdbc5/6 11.x最終解決:
已經黔驢技窮的情況下就嘗試下,又下載了一個低版本的數據庫驅動,替換了原裝驅動,JDK沒有動,再驗證通過了…
根本原因還是沒有太明白,也有可能是JDK版本和數據庫驅動兼容性的問題,但解決方案就是這樣,嘗試換下不同版本的驅動
PS:
我的數據庫版本是19c,當時驅動是直接使用的數據庫服務器下的這個驅動$ORACLE_HOME/jdbc/lib/ojdbc8.jar
后面也懷疑是驅動問題,就從官網上下載了對應版本的驅動,但還是報錯,就是這塊走進了小黑屋,就沒再想驅動的問題
最后解決了問題后,在這個目錄下./dmu/jlib/ojdbc8.jar也發現了還有一個ojdbc8.jar驅動,和后來下載的低版本驅動一致,嘗試使用了下一切正常
所以,如果遇到這樣的報錯,在確定代碼無問題的情況下,還是需要從驅動出發進行解決…
總結
以上是生活随笔為你收集整理的ORA-01005: null password given; logon denied的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html文本框中有一个叉号标志,html
- 下一篇: Tarena - 分组查询