I gone through given link and configured my web.xml file like
<resource-ref>
<description>xyz</description>
<res-ref-name>jdbc/WareHouse</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
and there is context.xml file in project name as strutsapp/WebContent/META-INF/context.xml. and the entries are as:
<Context docBase="${CATALINA_HOME}" privileged="true" antiResourceLocking="false"
antiJarLocking="false">
<Resource name="jdbc/WareHouse"
auth="Container"
type="javax.sql.DataSource"
username="db2admin" password="password"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://localhost:50000/HONDAS2"
maxActive="10"
maxIdle="4"
/>
</Context>
and i wrote java code like
Context initContext = new InitialContext();
Context envCtx = (Context) initContext.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/WareHouse");
con = ds.getConnection();
remember application is out side the webapp folder of tomcat 6. i m running this project through eclipse