JNDI配置DataSource的那些事儿
在使用TOMCAT6的时候,配置和使用JNDI都是非常简单的.
只要在应用的<Context>节点下配置RESOURCE:
<Resource name="jdbc/myds" auth="Container" type="javax.sql.DataSource" maxActive="50" maxIdle="30" maxWait="10000" logAbandoned="true" username="xxxxxx" password="xxxxxxx" driverClassName="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://xxxxx:60200/yyyyy"/>
lookup("java:comp/env/jdbc/myds")<resource-ref id="ResourceRef_1"><description>DEMO</description><res-ref-name>jdbc/demo</res-ref-name><res-type>javax.sql.DataSource</res-type><res-auth>Container</res-auth><res-sharing-scope>Shareable</res-sharing-scope></resource-ref>
<?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_1243746226890" virtualHostName="default_host"><webapp href="WEB-INF/web.xml#WebApp_ID" /><resRefBindings xmi:id="ResourceRefBinding_1"jndiName="jdbc/demo"> <bindingResourceRef href="WEB-INF/web.xml#ResourceRef_1" /></resRefBindings></webappbnd:WebAppBinding>