File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Error connecting to DB2 database in localhost Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error connecting to DB2 database in localhost" Watch "Error connecting to DB2 database in localhost" New topic
Author

Error connecting to DB2 database in localhost

Drake Almonto
Greenhorn

Joined: Apr 29, 2005
Posts: 16
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?

Thanks!


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 agree. Here's the link: http://aspose.com/file-tools
 
subject: Error connecting to DB2 database in localhost