sjkgxf7191 发表于 2013-1-30 02:17:13

Tomcat数据库连接池配置 和 共享线程池配置

Tomcat数据库连接池配置如下:

server.xml配置Resource:
 
<Resource name="jdbc/ExampleDB" auth="Container" type="javax.sql.DataSource"         maxActive="100" maxIdle="30" maxWait="10000"         username="APP" password="APP" driverClassName="org.apache.derby.jdbc.ClientDriver"         url="jdbc:derby://localhost:1527/springside-example;create=true"/> 
context.xml文件增加:
 
<WatchedResource>WEB-INF/web.xml</WatchedResource><ResourceLink name="jdbc/ExampleDB" global="jdbc/ExampleDB" type="javax.sql.DataSource"/> 
Tomcat共享线程池配置:

取消Executor注释,修改连接数至自己合适的数值既可。
 
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"         maxThreads="200" minSpareThreads="100" maxIdleTime="60000"/> 
executor="tomcatThreadPool" 标明此连接使用上面配置的名称为tomcatThreadPool的连接池,无属性共享连接不会生效 protocol表示使用的是 http协议 端口号为8080 
 
<Connector port="8080" protocol="HTTP/1.1" redirectPort="8443"      connectionTimeout="20000"      executor="tomcatThreadPool"   acceptCount="100"   useBodyEncodingForURI="true"   enableLookups="false"/>
页: [1]
查看完整版本: Tomcat数据库连接池配置 和 共享线程池配置