SSH2,进行多次库操作后 程序卡住,不报错,登录页面可以进,但登录不了
mysql数据库,C3P0连接池方式连接applicationContext.xml中的配置如下``<!-- 开启监听 -->
<aop:aspectj-autoproxy/>
<!-- 开启事务 -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/myweb?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull"/>
<property name="user" value="root"/>
<property name="password" value="root"/>
<property name="maxIdleTime" value="60"/><!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="initialPoolSize" value="10"/><!--初始化时获取10个连接,取值应在minPoolSize与maxPoolSize之间。Default: 10 -->
<property name="maxPoolSize" value="50"/><!--连接池中保留的最大连接数。Default: 50 -->
<property name="acquireIncrement" value="10"/><!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 10 -->
<property name="maxStatementsPerConnection" value="20"/><!--定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
<property name="minPoolSize" value="10"/>
<property name="testConnectionOnCheckin" value="true"/><!-- 获取connnection时测试是否有效 -->
<property name="automaticTestTable" value="C3P0TestTable"/><!-- 自动测试的table名称 -->
<property name="idleConnectionTestPeriod" value="18000"/><!-- 设置一个低于mysql中/etc/my.cnf中wait_timeout的时间,防止连接关闭 -->
<property name="testConnectionOnCheckout" value="true"/><!-- 如果服务器性能没问题,设置为true -->
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource"/>
<property name="mappingLocations">
<value>classpath*:/**/*.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">com.utils.PmDb2Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
mysql数据库,C3P0连接池方式连接applicationContext.xml中的配置如下``<!-- 开启监听 -->
<aop:aspectj-autoproxy/>
<!-- 开启事务 -->
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver"/>
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/myweb?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull"/>
<property name="user" value="root"/>
<property name="password" value="root"/>
<property name="maxIdleTime" value="60"/><!--最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 -->
<property name="initialPoolSize" value="10"/><!--初始化时获取10个连接,取值应在minPoolSize与maxPoolSize之间。Default: 10 -->
<property name="maxPoolSize" value="50"/><!--连接池中保留的最大连接数。Default: 50 -->
<property name="acquireIncrement" value="10"/><!--当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 10 -->
<property name="maxStatementsPerConnection" value="20"/><!--定义了连接池内单个连接所拥有的最大缓存statements数。Default: 0 -->
<property name="minPoolSize" value="10"/>
<property name="testConnectionOnCheckin" value="true"/><!-- 获取connnection时测试是否有效 -->
<property name="automaticTestTable" value="C3P0TestTable"/><!-- 自动测试的table名称 -->
<property name="idleConnectionTestPeriod" value="18000"/><!-- 设置一个低于mysql中/etc/my.cnf中wait_timeout的时间,防止连接关闭 -->
<property name="testConnectionOnCheckout" value="true"/><!-- 如果服务器性能没问题,设置为true -->
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name="dataSource" ref="dataSource"/>
<property name="mappingLocations">
<value>classpath*:/**/*.hbm.xml</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">com.utils.PmDb2Dialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货