アプリケーションのweb.xmlに追加
<resource-ref>
<description />
<res-ref-name>jdbc/sample</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

また、TOMCATのcommon/libにDB2のdb2java.zipの拡張子をjarに変えたものを入れました。
クラスパスを通すやり方はこれでよかったのでしょうか?

サーブレットの記述
 Properties env = new Properties();
 env.setPropert(Context.INITIAL_CONTEXT_FACTORY,
  "com.ibm.websphere.naming.WsnInitialContextFactory");
 Context ctx = new InitialContext(env);
 DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/sample");
ここを書き換えたりするのでしょうか?