Helpful Information
 
 
Category: DB2 Development
Java Servlet, JDBC, and IBM DB2

:confused:
Hi can anyone help me get my servlet to connect to a DB2 v8.1 database.

I have a java application that connects just fine to DB2

for my string url i'm using
jdbc:db2:mydatabase
and the driver i'm using is
COM.ibm.db2.jdbc.app.DB2Driver

I'm running the application on the same computer as where my DB2 is installed.

Now my problem is that my servlet cant seem to make a connection of the DB
i'm using the same url string and same driver
(tomcat is installed on the same computer as DB2)

Can someone show me how to make a proper connection
or the proper driver if i'm using the wrong driver.

Thanks

Post the code that works and the code that you are usin in the web app that does not work. Also post any error messages you are getting in the log file.

As long as the driver jar file is in WEB-INF/lib dir it should work no different than a regular java app.

Your using the system catalog to address the database. You can change your JDBC URL to use the hostname syntax (localhost port number) or you will have to source your sqllib/db2profile during Tomcat startup so it will know where mydatabase is.










privacy (GDPR)