I have a piece of code along the following lines:
Properties props = new Properties();
props.put("user", user.getUserName());
props.put("password", user.getPassword());
//add more properties
//...
Connection conn = DriverManager.getConnection("url",props);
So, there is no way that I can see that a null password property can be passed into the connection. Not only does user.getPassword() throw an exception if the password is null, setting a null value on props would throw an NPE. Either of this will cause the call to DriverManager.getConnection(..) to be bypassed. Yet on occasion, the connection attempt fails and Oracle returns an
ORA-01005 ORA-01005: null password given; logon denied
The only way I can recreate this on demand is by commenting out the line that sets the password. Otherwise I can't see how a null value is getting to Oracle.
Could it be that there are some values that Oracle reports to be null that are not strict Java nulls?
I'm using oracle.jdbc.OracleDriver to connect to Oracle 11.2.0.3.0
Many thanks for any help!