I am attempting to connect to a DB2 database from a servlet on my localhost. I am running with ServletExec ISAPI in IIS. I am receiving a NullPointerException from the DriverManager. The stack trace is included below. I have verified that I am sending the correct URL, user and password. I am able to connect to the database and query the tables from the command window on my machine. However, my servlet has trouble on the getConnection method in the DriverManager. The command is
con = DriverManager.getConnection(URL, user, password);
Can anyone help?
java.lang.NullPointerException at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source) at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source) at COM.ibm.db2.jdbc.app.DB2Connection.connect(Unknown Source) at COM.ibm.db2.jdbc.app.DB2Connection.(Unknown Source) at COM.ibm.db2.jdbc.app.DB2Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager.java:525) at java.sql.DriverManager.getConnection(DriverManager.java:171) at ConnectionManager$DBConnectionPool.newConnection(ConnectionManager.java:396) at ConnectionManager$DBConnectionPool.getConnection(ConnectionManager.java:330) at ConnectionManager.getConnection(ConnectionManager.java:83) at custMgr.singleCust.Logon.doGet(Logon.java:39)
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Error connecting to DB2 database in localhost