Last week we had an issue that a NullPointerException was thrown when we tried to use SAP HANA JDBC driver, and in our case it was caused by a property called “hostlist” which was added by SAP HANA JDBC driver.
In our system we use BoneCP to manage database connections which uses java.sql.DriverManager to manage JDBC drivers, and we have several other JDBC drivers loaded. When we try to establish a connection to a SAP HANA server, java.sql.DriverManager.getConnection method will be called, and the SAP HANA driver will add a property, which uses “hostlist” as key and an array list as value, to the property list, and this property list will also be used by other registered JDBC drivers. In our case, this “hostlit” property caused postgreSQL JDBC driver to throw a NullPointerException. Our workaround for this issue is to remove this property after the SAP HANA JDBC driver added it, and it works fine for now, but we don’t know if there would be other problems.
Since we caught this problem in java.sql.DriverManager.getConnection method which is part of the JDK 1.7 and thus this should be a standard way to handle JDBC connection, we wonder if this could be a bug of SAP HANA JDBC driver.