- 浏览: 432710 次
- 性别:
- 来自: 郑州
文章分类
最新评论
-
shenselongge:
/**
* Flips this buff ...
java.nio.Buffer flip()方法jdk中文翻译错误 -
tonyyan:
感谢,清晰了很多。
java.nio.Buffer flip()方法jdk中文翻译错误 -
frangejct:
jdluojing 写道你的说法也不完整,buffer中的 ...
java.nio.Buffer flip()方法jdk中文翻译错误 -
victor0535:
关于这段话,我有不同看法:2)如果instance变量是一个对 ...
Java线程同步机制synchronized关键字的理解 -
josico:
如果没有前台页面 只是作为服务端提供HTTP接口的话 可不可以 ...
Apache与Tomcat的区别
基于ssh的proxool连接池配置
环境:MyEclipse5.5,win 2003,oracle,mysql
配置文件1:applicationContext.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"><!-- 数据源类采用JDBC数据源 -->
<property name="driverClassName">
<!-- 将数据库连接交给了proxool管理,使它的驱动 --> <value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<!-- 数据库连接池的别名,与你的proxool.xml中的Alias必须一致 -->
<value>proxool.DbPool</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!--
此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode,有很多说明,在此不多说
-->
<prop key="hibernate.connection.release_mode">
after_statement
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>cn/wt/vo/Admin.hbm.xml</value>
<value>cn/wt/vo/User.hbm.xml</value>
<value>cn/wt/vo/Workdate.hbm.xml</value>
</list>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="adminDao" class="cn.wt.dao.AdminDao" abstract="true" />
<bean id="adminDaoImpl" class="cn.wt.dao.impl.AdminDaoImpl"
parent="adminDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="workDateDao" class="cn.wt.dao.WorkDateDao"
abstract="true" />
<bean id="workDateDaoImpl" class="cn.wt.dao.impl.WorkDateDaoImpl"
parent="workDateDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="userDao" class="cn.wt.dao.UserDao" abstract="true" />
<bean id="userDaoImpl" class="cn.wt.dao.impl.UserDaoImpl" parent="userDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>
<bean name="/adminAction" class="cn.wt.struts.action.AdminAction">
<property name="adminDao">
<ref bean="adminDaoImpl" />
</property>
</bean>
<bean name="/workdateAction"
class="cn.wt.struts.action.WorkdateAction">
<property name="workDateDao">
<ref bean="workDateDaoImpl" />
</property>
<property name="userDao">
<ref bean="userDaoImpl"/>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"><!-- 数据源类采用JDBC数据源 -->
<property name="driverClassName">
<!-- 将数据库连接交给了proxool管理,使它的驱动 --> <value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<!-- 数据库连接池的别名,与你的proxool.xml中的Alias必须一致 -->
<value>proxool.DbPool</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!--
此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode,有很多说明,在此不多说
-->
<prop key="hibernate.connection.release_mode">
after_statement
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>cn/wt/vo/Admin.hbm.xml</value>
<value>cn/wt/vo/User.hbm.xml</value>
<value>cn/wt/vo/Workdate.hbm.xml</value>
</list>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="adminDao" class="cn.wt.dao.AdminDao" abstract="true" />
<bean id="adminDaoImpl" class="cn.wt.dao.impl.AdminDaoImpl"
parent="adminDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="workDateDao" class="cn.wt.dao.WorkDateDao"
abstract="true" />
<bean id="workDateDaoImpl" class="cn.wt.dao.impl.WorkDateDaoImpl"
parent="workDateDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="userDao" class="cn.wt.dao.UserDao" abstract="true" />
<bean id="userDaoImpl" class="cn.wt.dao.impl.UserDaoImpl" parent="userDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>
<bean name="/adminAction" class="cn.wt.struts.action.AdminAction">
<property name="adminDao">
<ref bean="adminDaoImpl" />
</property>
</bean>
<bean name="/workdateAction"
class="cn.wt.struts.action.WorkdateAction">
<property name="workDateDao">
<ref bean="workDateDaoImpl" />
</property>
<property name="userDao">
<ref bean="userDaoImpl"/>
</property>
</bean>
</beans>
配置文件2:/WEB-INF/proxool.xml
Xml代码
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DbPool</alias> //与applicationContext.xml中url一致
<driver-url>jdbc:mysql://localhost:3306/mysql</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="123" />
<property name="useUnicode" value="true" />
<property name="characterEncoding" value="GBK" />
</driver-properties>
<minimum-connection-count>5</minimum-connection-count>
<maximum-connection-count>50</maximum-connection-count>
<maximum-active-time>60000</maximum-active-time>
<house-keeping-test-sql>select 1</house-keeping-test-sql>
<prototype-count>5</prototype-count>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
</proxool>
</something-else-entirely>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DbPool</alias> //与applicationContext.xml中url一致
<driver-url>jdbc:mysql://localhost:3306/mysql</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="123" />
<property name="useUnicode" value="true" />
<property name="characterEncoding" value="GBK" />
</driver-properties>
<minimum-connection-count>5</minimum-connection-count>
<maximum-connection-count>50</maximum-connection-count>
<maximum-active-time>60000</maximum-active-time>
<house-keeping-test-sql>select 1</house-keeping-test-sql>
<prototype-count>5</prototype-count>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
</proxool>
</something-else-entirely>
配置文件3:web.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>
org.logicalcobwebs.proxool.configuration.ServletConfigurator
</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/proxool.xml</param-value>
</init-param>
<!-- 由于proxool要先加载,所以启动优先级要比spring高,否则在spring加载时会报错 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<!-- 数据库连接监控器 -->
<servlet-name>proxoolAdmin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>proxoolAdmin</servlet-name>
<url-pattern>/proxoolAdmin</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>
org.logicalcobwebs.proxool.configuration.ServletConfigurator
</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/proxool.xml</param-value>
</init-param>
<!-- 由于proxool要先加载,所以启动优先级要比spring高,否则在spring加载时会报错 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<!-- 数据库连接监控器 -->
<servlet-name>proxoolAdmin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>proxoolAdmin</servlet-name>
<url-pattern>/proxoolAdmin</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
基本配置就这些,以前在根据网上所说的很多利用spring直接管理proxool的方法来实现,这种方法也可以,但有几点问题,1.mysql连接的URL:jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=GBK中间的&符号,在xml中使用&来代替,但我在做测试时发现这样做不行,spring在启动时会报没有这样的驱动,还有些根本就是错误的估计是在网上转来转去,没经过测试就发表的.
关于连接释放,在applicationContext.xml中绝对有必要增加hibernate.connection.release_mode这一参数,而且比较的好的设置应该是after_statement,另一种是after_transaction,而使用after_statement优于after_transaction原因是避免了在一个事务结束后连接就释放,大家可以试一下先将这个参数去掉,运几次数据库操作,会发现产了生很多连接没有释放,大概大30秒至15秒之间可以释放有时会更长,然后在加上这个参数测试.
环境:MyEclipse5.5,win 2003,oracle,mysql
配置文件1:applicationContext.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"><!-- 数据源类采用JDBC数据源 -->
<property name="driverClassName">
<!-- 将数据库连接交给了proxool管理,使它的驱动 --> <value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<!-- 数据库连接池的别名,与你的proxool.xml中的Alias必须一致 -->
<value>proxool.DbPool</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!--
此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode,有很多说明,在此不多说
-->
<prop key="hibernate.connection.release_mode">
after_statement
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>cn/wt/vo/Admin.hbm.xml</value>
<value>cn/wt/vo/User.hbm.xml</value>
<value>cn/wt/vo/Workdate.hbm.xml</value>
</list>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="adminDao" class="cn.wt.dao.AdminDao" abstract="true" />
<bean id="adminDaoImpl" class="cn.wt.dao.impl.AdminDaoImpl"
parent="adminDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="workDateDao" class="cn.wt.dao.WorkDateDao"
abstract="true" />
<bean id="workDateDaoImpl" class="cn.wt.dao.impl.WorkDateDaoImpl"
parent="workDateDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="userDao" class="cn.wt.dao.UserDao" abstract="true" />
<bean id="userDaoImpl" class="cn.wt.dao.impl.UserDaoImpl" parent="userDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>
<bean name="/adminAction" class="cn.wt.struts.action.AdminAction">
<property name="adminDao">
<ref bean="adminDaoImpl" />
</property>
</bean>
<bean name="/workdateAction"
class="cn.wt.struts.action.WorkdateAction">
<property name="workDateDao">
<ref bean="workDateDaoImpl" />
</property>
<property name="userDao">
<ref bean="userDaoImpl"/>
</property>
</bean>
</beans>
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource"><!-- 数据源类采用JDBC数据源 -->
<property name="driverClassName">
<!-- 将数据库连接交给了proxool管理,使它的驱动 --> <value>org.logicalcobwebs.proxool.ProxoolDriver</value>
</property>
<property name="url">
<!-- 数据库连接池的别名,与你的proxool.xml中的Alias必须一致 -->
<value>proxool.DbPool</value>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.connection.autocommit">true</prop>
<prop key="hibernate.show_sql">true</prop>
<!--
此处要注意因为proxool自己释放数据库连接比慢,所以要在此给出释放连接的模式,具体几种模式对应的意思,可以Google一下hibernate.connection.release_mode,有很多说明,在此不多说
-->
<prop key="hibernate.connection.release_mode">
after_statement
</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>cn/wt/vo/Admin.hbm.xml</value>
<value>cn/wt/vo/User.hbm.xml</value>
<value>cn/wt/vo/Workdate.hbm.xml</value>
</list>
</property>
</bean>
<bean id="hibernateTemplate"
class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="adminDao" class="cn.wt.dao.AdminDao" abstract="true" />
<bean id="adminDaoImpl" class="cn.wt.dao.impl.AdminDaoImpl"
parent="adminDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="workDateDao" class="cn.wt.dao.WorkDateDao"
abstract="true" />
<bean id="workDateDaoImpl" class="cn.wt.dao.impl.WorkDateDaoImpl"
parent="workDateDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate" />
</property>
</bean>
<bean id="userDao" class="cn.wt.dao.UserDao" abstract="true" />
<bean id="userDaoImpl" class="cn.wt.dao.impl.UserDaoImpl" parent="userDao">
<property name="hibernateTemplate">
<ref bean="hibernateTemplate"/>
</property>
</bean>
<bean name="/adminAction" class="cn.wt.struts.action.AdminAction">
<property name="adminDao">
<ref bean="adminDaoImpl" />
</property>
</bean>
<bean name="/workdateAction"
class="cn.wt.struts.action.WorkdateAction">
<property name="workDateDao">
<ref bean="workDateDaoImpl" />
</property>
<property name="userDao">
<ref bean="userDaoImpl"/>
</property>
</bean>
</beans>
配置文件2:/WEB-INF/proxool.xml
Xml代码
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DbPool</alias> //与applicationContext.xml中url一致
<driver-url>jdbc:mysql://localhost:3306/mysql</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="123" />
<property name="useUnicode" value="true" />
<property name="characterEncoding" value="GBK" />
</driver-properties>
<minimum-connection-count>5</minimum-connection-count>
<maximum-connection-count>50</maximum-connection-count>
<maximum-active-time>60000</maximum-active-time>
<house-keeping-test-sql>select 1</house-keeping-test-sql>
<prototype-count>5</prototype-count>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
</proxool>
</something-else-entirely>
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- the proxool configuration can be embedded within your own application's.
Anything outside the "proxool" tag is ignored. -->
<something-else-entirely>
<proxool>
<alias>DbPool</alias> //与applicationContext.xml中url一致
<driver-url>jdbc:mysql://localhost:3306/mysql</driver-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver-properties>
<property name="user" value="root" />
<property name="password" value="123" />
<property name="useUnicode" value="true" />
<property name="characterEncoding" value="GBK" />
</driver-properties>
<minimum-connection-count>5</minimum-connection-count>
<maximum-connection-count>50</maximum-connection-count>
<maximum-active-time>60000</maximum-active-time>
<house-keeping-test-sql>select 1</house-keeping-test-sql>
<prototype-count>5</prototype-count>
<house-keeping-sleep-time>60000</house-keeping-sleep-time>
</proxool>
</something-else-entirely>
配置文件3:web.xml
Xml代码
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>
org.logicalcobwebs.proxool.configuration.ServletConfigurator
</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/proxool.xml</param-value>
</init-param>
<!-- 由于proxool要先加载,所以启动优先级要比spring高,否则在spring加载时会报错 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<!-- 数据库连接监控器 -->
<servlet-name>proxoolAdmin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>proxoolAdmin</servlet-name>
<url-pattern>/proxoolAdmin</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/classes/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>proxoolServletConfigurator</servlet-name>
<servlet-class>
org.logicalcobwebs.proxool.configuration.ServletConfigurator
</servlet-class>
<init-param>
<param-name>xmlFile</param-name>
<param-value>/WEB-INF/proxool.xml</param-value>
</init-param>
<!-- 由于proxool要先加载,所以启动优先级要比spring高,否则在spring加载时会报错 -->
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<!-- 数据库连接监控器 -->
<servlet-name>proxoolAdmin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>proxoolAdmin</servlet-name>
<url-pattern>/proxoolAdmin</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>
org.apache.struts.action.ActionServlet
</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
基本配置就这些,以前在根据网上所说的很多利用spring直接管理proxool的方法来实现,这种方法也可以,但有几点问题,1.mysql连接的URL:jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=GBK中间的&符号,在xml中使用&来代替,但我在做测试时发现这样做不行,spring在启动时会报没有这样的驱动,还有些根本就是错误的估计是在网上转来转去,没经过测试就发表的.
关于连接释放,在applicationContext.xml中绝对有必要增加hibernate.connection.release_mode这一参数,而且比较的好的设置应该是after_statement,另一种是after_transaction,而使用after_statement优于after_transaction原因是避免了在一个事务结束后连接就释放,大家可以试一下先将这个参数去掉,运几次数据库操作,会发现产了生很多连接没有释放,大概大30秒至15秒之间可以释放有时会更长,然后在加上这个参数测试.
相关推荐
3. **Hadoop部署与升级**:`http://www.slideshare.net/steve_l/dynamic-hadoop-clusters`, `http://zkl-1987.javaeye.com/blog/365172`, `http://www.javaeye.com/topic/365172` - 提供了Hadoop集群部署的最佳实践...
3. **参考文章**:《Flex企业级信息系统开发》[http://www.javaeye.com/topic/109883](http://www.javaeye.com/topic/109883) - 该文章主要介绍了使用Flex开发企业级信息系统的实践经验和技术要点,对于想要深入...
4. 谁告诉我extjs官方网站上按需下载js库的页面在哪里(http://www.javaeye.com/wiki/topic/166010) 通过这些资料,开发者可以深入理解EXT-JS的加载机制,找到优化加载速度的方法,并运用在线Build工具进行实践,...
- **Ruby操作Excel**:`http://www.javaeye.com/topic/46768` 提供了Ruby操作Excel的方法。 - **Ruby自带教程**:位于 `C:\ruby\doc\ProgrammingRuby.chm` ,提供了详细的Ruby教程。 - **Ruby自带示例**:位于 `C:\...
**ZDNet** - http://forums.zdnet.com.cn/cgi-bin/topic.cgi?forum=45&topic=2 ZDNet是一个全球知名的科技新闻和评论网站,其论坛包含Java和其他技术领域的讨论。 #### 20. **SpringSide** - ...
原址:http://www.javaeye.com/topic/211875 其他:http://www.17ext.com/showtopic-2753.aspx 欢迎加入QQ群:62150370 进行extjs的讨论 如果你没有安装mysql5.0,在安装数据库时,请把root密码设置为neostudio 如果已...
原址:http://www.javaeye.com/topic/211875 其他:http://www.17ext.com/showtopic-2753.aspx 欢迎加入QQ群:62150370 进行extjs的讨论 如果你没有安装mysql5.0,在安装数据库时,请把root密码设置为neostudio 如果已...
原址:http://www.javaeye.com/topic/211875 其他:http://www.17ext.com/showtopic-2753.aspx 讨论Q_群:62150370(群1) 76202406(群2) 91986229(群3) 一起讨论 如果你没有安装mysql5.0,在安装数据库时,请把root密码...
http://www.javaeye.com/topic/52975 只不过有些不同: 1. 我的spring使用myeclipse向导加入的2.5版本 (附件中不包含) 2. 我加入的是(源代码中已存在): acegi-security-1.0.7.jar 加入了数据库驱动(mysql5...
---javaeye相关地址:http://www.javaeye.com/topic/379655 ---Java版山寨星际 做了一大堆J2EE WEB应用之后,闲来无事决定研究一下桌面应用程序开发。 想了一下干脆做个Java版的星际,研究的对象就是星际的JS山寨版...
### Android SDK开发环境搭建知识点详解 ...- [JavaEye Wiki](http://www.javaeye.com/wiki/topic/689383) 通过以上步骤,您可以成功地搭建一套基本的Android开发环境,为开发应用程序打下坚实的基础。
转自 http://www.javaeye.com/topic/890512 MyEclipse6.5的反编译插件的安装 我的MyEclipse6.5的安 装目录是D:\MyEclipse 6.5,以下仅供参考 第一步: 下载jad.exe(Jad v1.5.8g版本)和net.sf.jadclipse_3.3.0.jar;...
Flexigrid-Web2.0 jQuery表格插件 Flexigrid 是一个轻量级的Web2.0 jQuery插件。它包含很多非常Cool的特性,如主题定制、分页、工具栏、搜索、排序、ajax读取数据源、调整列宽...http://www.javaeye.com/topic/414611
ruby勇士,初学者边游戏边学习ruby的好玩的东西。具体玩法在 http://www.javaeye.com/topic/383938,或者Google一下“ruby勇士”。因为下载游戏的网站有时访问不了,上传一下提供下载。
- [XML解析-JDOM](http://www.javaeye.com/topic/233911) - [XPath-JDOM](http://8366.javaeye.com/blog/354547) - [JDOM环境配置](http://qzone.qq.com/blog/21243296-1230278127) #### 四、结论 - 本文档提供...
- [JavaEye论坛关于PermGen space的讨论](http://www.javaeye.com/topic/80620?page=1) - [Sohu博客关于PermGen space的解释](http://ggmm.blog.sohu.com/117545379.html) - [百度博客关于JVM内存管理的文章]...
- [参考链接](http://www.javaeye.com/topic/552177) - **Step 2**: 配置KindEditor的使用方法。 - [参考链接](http://jonney-82.javaeye.com/blog/447579) - **Step 3**: 修改特定文件中的路径配置。 - 修改`...
- JavaEye 主键生成策略讨论: http://www.javaeye.com/topic/93391 通过理解并熟练掌握 `hbm.xml` 文件的配置,开发者可以有效地利用 Hibernate 实现对象与数据库之间的无缝映射,提高开发效率并减少数据库操作的...
参考提供的网址,如`http://www.pjprimer.com/view-1019-1.html`和`http://www.javaeye.com/topic/640468`,你可以找到更详细的步骤和解决问题的方法。 总的来说,安装GWT并使用MyEclipse进行开发是一项相对简单的...
http://www.javaeye.com/topic/128973 1 struts2表单标签 1 1、struts资源文件中文解决方法 1 2、开发struts2流程 1 3、创建拦截器: 2 4.标签中引用资源文件内容 3 5.创建资源文件 3 6.Action中访问servlet API 3...