Thursday, October 30, 2008

ORA-01005: null password given; logon denied

I was doing a simple POC of JDBC.
My system configuration is

Operating System : Windows XP
OS Architecture : x86
OS Version : 5.1
Database Version : Oracle Database 10g Express Edition Release 10.2.0.1.0 - Beta
Java Version : 1.5.0_16
JDBC Jar File : OJDBC5.jar

When I tried to run the program I was getting "null password given; logon denied", yeah I know the reason :) I cross checked that I have missed giving password but NO wait...I have given it correctly, but still I was getting "null password given; logon denied".

I searched net for any issues related to it, and found one blog where it says change the language settings, I tried it but had no success. So I went and saw was I using correct ojdbc5.jar file, looked like I was using correct jar and that too with correct version of JAVA but still I got the error. after struggling for 3 days I just thought to use the jar provided by ORACLE XE in %ORACLE_HOME%/lib, it contained ojdbc1.4.jar and ojdbc1_g.jar it says to use this jar with JDK1.4 but I was using 1.5 but still wanted to test it. so I went ahead and used 1.4 drivers instead of 5.jar, it just worked out...... :) but still have to figure out why I was getting "null password given; logon denied" when I was using ojdbc5.jar which should be used with JAVA 1.5.