aspose file tools*
The moose likes Tomcat and the fly likes JNDI and DB2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "JNDI and DB2" Watch "JNDI and DB2" New topic
Author

JNDI and DB2

Eric Braun
Greenhorn

Joined: Apr 13, 2004
Posts: 11
Hello,

I am trying to connect Tomcat to a DB2 database. I have it working on Websphere App Dev, but now I am attempting to move it over to Tomcat.

Error is:
Unexpected error; javax.naming.NameNotFoundException: Name DBDatasource is not bound in this Context
com.ibm.db.beans.DBException: Unexpected error; javax.naming.NameNotFoundException: Name DBDatasource is not bound in this Context

1. I added db2java.zip to the lib folder.
2. Edited the web.xml as the following:

<resource-ref id="ResourceRef_1100642207292">
<res-ref-name>jdbc/DBDatasource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

3. Edited server.xml as the following:
<ResourceParams name="jdbc/DBDatasource">
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>db2admin</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc b2:TECHBOOK</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>db2admin</value>
</parameter>
</ResourceParams>
[ November 18, 2004: Message edited by: Eric Braun ]
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

rename db2java.zip to db2java.jar. Tomcat won't load *.zip files.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI and DB2