IBM / JTOpen

IBM Toolbox for Java, an IBM i communications library
https://ibm.github.io/JTOpen/
Other
60 stars 28 forks source link

AS400JDBCDataDatasource not using password property #157

Closed jeber-ibm closed 8 months ago

jeber-ibm commented 8 months ago

When setting the properties for an AS400JDBCDataSource, the password in the properties object is not being used.

The exception looks like the following.

java.lang.NullPointerException: password at com.ibm.as400.access.AS400.checkPasswordNullAndLength(AS400.java:4860) at com.ibm.as400.access.AS400.setPassword(AS400.java:4267) at com.ibm.as400.access.AS400JDBCDataSource.setPassword(AS400JDBCDataSource.java:3594) at com.ibm.as400.access.AS400JDBCDataSource.setProperties(AS400JDBCDataSource.java:3836)

The problem can be created by using the following.

java -jar jt400.jar jdbc:as400:somehost userid password !PRINTSTACKTRACE true !setnewvar properties=java.util.Properties() !setnewvar dataSource = com.ibm.as400.access.AS400JDBCConnectionPoolDataSource() !callmethod properties.put("user", userid) !callmethod properties.put("password", password) !callmethod dataSource.setProperties(properties)

jeber-ibm commented 8 months ago

Corresponding test issue is https://github.com/IBM/JTOpen-test/issues/63