1、代码中JNDI名用“java:comp/env/xxx”。 2、Web.xml中添加内容如下: <resource-ref id="ResourceRef_1185421895921"> <description></description> <res-ref-name>jdbc/newheroDS</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope></resource-ref> 3、新建文件ibm-web-bnd.xmi,内容如下: <?xml version="1.0" encoding="UTF-8"?><webappbnd:WebAppBinding xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:webappbnd="webappbnd.xmi" xmi:id="WebAppBinding_1185421895921"> <webapp href="WEB-INF/web.xml#WebApp_1185420369171"/> <resRefBindings xmi:id="ResourceRefBinding_1185421895921" jndiName="jdbc/newheroDS"> <bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1185421895921"/> </resRefBindings></webappbnd:WebAppBinding> 注:以上步骤完全可以用RAD可视化编辑器完成。