Hello!
I tried to get my J2EE app working with DB2 for several days and now
it seems to work, but... (Tomcat 5.0.19 on NT 4.0 with J2SDK 1.4.1_02)
1) Declaring the DB2-datasource in $CATALINA_HOME/conf/server.xml did
not work.
All I got was a message like "Cannot create JDBC driver of class ''
for connect URL 'null', cause: null"
2) DB2-Driver (COM.ibm.db2.jdbc.app.DB2Driver) is in
CATALINA_HOME/common/lib, file renamed from db2java.zip to db2java.jar
3) I tried to place the ResourceParams in <GlobalNamingResources>,
then in <Context...>, but nothing worked for me...
4) Finally I placed a file myApp.xml in
$CATALINA_HOME/conf/Catalina/localhost and declared the datasource in
this file.
5) This way it works fine now. But here comes the question: Is it "the
right way" to place my config-file in
$CATALINA_HOME/conf/Catalina/localhost?
Thanks for each helpful idea.
Oliver
//--- Content of $CATALINA_HOME/conf/Catalina/localhost/myApp.xml
---------
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="myApp" path="/myApp"
docBase="D:\Programme\jakarta-tomcat-5.0.19\webapps\myApp">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="myApp_log." suffix=".txt"
timestamp="true"/>
<Resource auth="Container" name="jdbc/myApp"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myApp">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFact ory</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>...</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:db2:myApp</value>
</parameter>
<parameter>
<name>driverName</name>/database
<value>jdbc:db2:myApp</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>...</value>
</parameter>
</ResourceParams>
</Context>
// --- EOF -----------