web.xml 中 resource-ref 的注意事项

 配置说明:

web.xml 中配置

<resource-ref>
  <description>Employees Database for HR Applications</description>
  <res-ref-name>jdbc/EmployeeDB</res-ref-name>
  <res-ref-type>javax.sql.DataSource</res-ref-type>
  <res-auth>Container</res-auth>
</resource-ref>

 

res-ref-name/
res-env-ref-name

资源的名称,相对于java:comp/env context

  

对应的jabc连接池配置文件:

tomcatconfCatalinalocalhostemployer.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="E:	omcatwebapps	est" path="/test" reloadable="true">
	<Resource name="jdbc/EmployeeDB"
	auth="Container"
	type="javax.sql.DataSource"
	maxActive="1000"
	maxIdle="30"
	maxWait="100"
	username="root"
	password="root"
	driverClassName="com.mysql.jdbc.Driver"
	url="jdbc:mysql://localhost:3306/test?useUnicode=true"/>
</Context>

  

原文地址:https://www.cnblogs.com/estellez/p/5017000.html