Spring 连接多个数据库 MYSQL 性能问题!报错could not execute query;

gwy13620867 2010-12-26 11:17:45
3台服务器 aDataSource本地----bDataSource国内----cDataSource美国(服务器上面网站有100多个)
表结构 数据都一样
本地---国内 连接都正常 连接美国服务器就出现问题。。。。。

现在要整理项目 统一用SSH2 把项目整理的规范点 想把链接的数据源全部配置在Spring里面,不想系统太乱了,
之前用jdbc直接写连接Connection 也经常报
Communications link failure

Last packet sent to the server was 84640 ms ago.
错误!!或者连接超时!!有没有什么办法 来解决这个问题。。。。。

连接数据库都正常连接上去 就是获取ResultSet结果集的时候 就报错!!但是过一会就出问题.... 所以现在考虑优化连接或者对于MYSQL 美国的服务器进行优化!




错误代码

Exception in thread "timerFactory" org.springframework.dao.DataAccessResourceFailureException: could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:625)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912)
at com.yilainetwork.dao.CommonDao.findByHqlC(CommonDao.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:108)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy16.findByHqlC(Unknown Source)
at com.yilainetwork.service.impl.OrdersService.findOrdersC(OrdersService.java:229)
at com.yilainetwork.util.testConnectionData.run(testConnectionData.java:31)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: org.hibernate.exception.JDBCConnectionException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:97)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2235)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2129)
at org.hibernate.loader.Loader.list(Loader.java:2124)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1149)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921)
at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
... 20 more
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

Last packet sent to the server was 84640 ms ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3009)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2895)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3438)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1951)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2101)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2554)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1761)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1912)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1812)
at org.hibernate.loader.Loader.doQuery(Loader.java:697)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259)
at org.hibernate.loader.Loader.doList(Loader.java:2232)
... 30 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2452)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2906)
... 43 more



...全文
284 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
gwy13620867 2010-12-26
  • 打赏
  • 举报
回复

public class CustomerContextHolder {

private static final ThreadLocal contextHolder = new ThreadLocal();

public static void setCustomerType(String customerType) {
Assert.notNull(customerType, "customerType cannot be null");
contextHolder.set(customerType);
}

public static String getCustomerType() {
return (String) contextHolder.get();
}

public static void clearCustomerType() {
contextHolder.remove();
}
}

public class DynamicDataSourceType {
public static final String A= "aSessionFactory";
public static final String B= "bSessionFactory";
public static final String C= "cSessionFactory";
}

package com.yilainetwork.dao;

import java.io.Serializable;
import java.sql.Connection;
import java.util.Map;
import java.util.Set;

import javax.naming.NamingException;
import javax.naming.Reference;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.HibernateException;
import org.hibernate.Interceptor;
import org.hibernate.SessionFactory;
import org.hibernate.StatelessSession;
import org.hibernate.classic.Session;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
import org.hibernate.stat.Statistics;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class MultiSessionFactory implements SessionFactory, ApplicationContextAware {
private static final long serialVersionUID = 2064557324203496378L;
private static final Log log = LogFactory.getLog(MultiSessionFactory.class);
private ApplicationContext applicationContext = null;
private SessionFactory sessionFactory = null;

public ApplicationContext getApplicationContext() {
return applicationContext;
}

public void setApplicationContext(ApplicationContext applicationContext) {
this.applicationContext = applicationContext;
}

public SessionFactory getSessionFactory(String sessionFactoryName) {
log.debug("sessionFactoryName:"+sessionFactoryName);
System.out.println(sessionFactoryName);
try{
if(sessionFactoryName==null||sessionFactoryName.equals("")){
return sessionFactory;
}
return (SessionFactory)this.getApplicationContext().getBean(sessionFactoryName);
}catch(NoSuchBeanDefinitionException ex){
throw new RuntimeException("There is not the sessionFactory <name:"+sessionFactoryName+"> in the applicationContext!");
}
}

public SessionFactory getSessionFactory() {
String sessionFactoryName = CustomerContextHolder.getCustomerType();
return getSessionFactory(sessionFactoryName);
}

public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}


/* (non-Javadoc)
* @see org.hibernate.SessionFactory#close()
*/
public void close() throws HibernateException {
getSessionFactory().close();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evict(java.lang.Class)
*/
public void evict(Class persistentClass) throws HibernateException {
getSessionFactory().evict(persistentClass);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evict(java.lang.Class, java.io.Serializable)
*/
public void evict(Class persistentClass, Serializable id) throws HibernateException {
getSessionFactory().evict(persistentClass, id);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictCollection(java.lang.String)
*/
public void evictCollection(String roleName) throws HibernateException {
getSessionFactory().evictCollection(roleName);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictCollection(java.lang.String, java.io.Serializable)
*/
public void evictCollection(String roleName, Serializable id) throws HibernateException {
getSessionFactory().evictCollection(roleName, id);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictEntity(java.lang.String)
*/
public void evictEntity(String entityName) throws HibernateException {
getSessionFactory().evictEntity(entityName);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictEntity(java.lang.String, java.io.Serializable)
*/
public void evictEntity(String entityName, Serializable id) throws HibernateException {
getSessionFactory().evictEntity(entityName, id);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictQueries()
*/
public void evictQueries() throws HibernateException {
getSessionFactory().evictQueries();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#evictQueries(java.lang.String)
*/
public void evictQueries(String cacheRegion) throws HibernateException {
getSessionFactory().evictQueries(cacheRegion);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getAllClassMetadata()
*/
public Map getAllClassMetadata() throws HibernateException {
return getSessionFactory().getAllClassMetadata();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getAllCollectionMetadata()
*/
public Map getAllCollectionMetadata() throws HibernateException {
return getSessionFactory().getAllCollectionMetadata();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getClassMetadata(java.lang.Class)
*/
public ClassMetadata getClassMetadata(Class persistentClass) throws HibernateException {
return getSessionFactory().getClassMetadata(persistentClass);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getClassMetadata(java.lang.String)
*/
public ClassMetadata getClassMetadata(String entityName) throws HibernateException {
return getSessionFactory().getClassMetadata(entityName);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getCollectionMetadata(java.lang.String)
*/
public CollectionMetadata getCollectionMetadata(String roleName) throws HibernateException {
return getSessionFactory().getCollectionMetadata(roleName);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getCurrentSession()
*/
public Session getCurrentSession() throws HibernateException {
return getSessionFactory().getCurrentSession();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getDefinedFilterNames()
*/
public Set getDefinedFilterNames() {
return getSessionFactory().getDefinedFilterNames();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getFilterDefinition(java.lang.String)
*/
public FilterDefinition getFilterDefinition(String filterName) throws HibernateException {
return getSessionFactory().getFilterDefinition(filterName);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#getStatistics()
*/
public Statistics getStatistics() {
return getSessionFactory().getStatistics();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#isClosed()
*/
public boolean isClosed() {
return getSessionFactory().isClosed();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openSession()
*/
public Session openSession() throws HibernateException {
return getSessionFactory().openSession();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openSession(java.sql.Connection)
*/
public Session openSession(Connection connection) {
return getSessionFactory().openSession(connection);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openSession(org.hibernate.Interceptor)
*/
public Session openSession(Interceptor interceptor) throws HibernateException {
return getSessionFactory().openSession(interceptor);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openSession(java.sql.Connection, org.hibernate.Interceptor)
*/
public Session openSession(Connection connection, Interceptor interceptor) {
return getSessionFactory().openSession(connection, interceptor);
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openStatelessSession()
*/
public StatelessSession openStatelessSession() {
return getSessionFactory().openStatelessSession();
}
/* (non-Javadoc)
* @see org.hibernate.SessionFactory#openStatelessSession(java.sql.Connection)
*/
public StatelessSession openStatelessSession(Connection connection) {
return getSessionFactory().openStatelessSession(connection);
}
/* (non-Javadoc)
* @see javax.naming.Referenceable#getReference()
*/
public Reference getReference() throws NamingException {
return getSessionFactory().getReference();
}
}

public class CommonDao extends HibernateDaoSupport implements ICommonDao {
private HibernateTemplate getHT() {
return super.getHibernateTemplate();
}
public List findByHqlA(String hql, Object[] params) {
System.out.println("------------------------执行数据库1");
CustomerContextHolder.setCustomerType(DynamicDataSourceType.A);
return this.getHT().find(hql, params);
}

public List findByHqlB(String hql, Object[] params) {
System.out.println("------------------------执行数据库2");
CustomerContextHolder.setCustomerType(DynamicDataSourceType.B);
return this.getHT().find(hql, params);
}

public List findByHqlC(String hql, Object[] params) {
System.out.println("------------------------执行数据库3");
CustomerContextHolder.setCustomerType(DynamicDataSourceType.C);
return this.getHT().find(hql, params);
}
}

gwy13620867 2010-12-26
  • 打赏
  • 举报
回复

<bean id="aSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource">
<ref bean="aDataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.yilainetwork.entity.User</value>
<value>com.yilainetwork.entity.Department</value>
<value>com.yilainetwork.entity.Orders</value>
<value>com.yilainetwork.entity.OrdersProducts</value>
<value>com.yilainetwork.entity.OrdersStatus</value>
<value>com.yilainetwork.entity.Products</value>
<value>com.yilainetwork.entity.ProductsCategory</value>
<value>com.yilainetwork.entity.WebDatabase</value>
<value>com.yilainetwork.entity.ReadOrdersLog</value>
<value>com.yilainetwork.entity.Company</value>
<value>com.yilainetwork.entity.DeliverOrder</value>
<value>com.yilainetwork.entity.Currencies</value>
<value>com.yilainetwork.entity.OrdersStatusHistory</value>
<value>com.yilainetwork.entity.OrdersCommentHistory</value>
<value>com.yilainetwork.entity.EmailWeb</value>
<value>com.yilainetwork.entity.Customers</value>
<value>com.yilainetwork.entity.StatisticsIp</value>
<value>com.yilainetwork.entity.Configuration</value>
<value>com.yilainetwork.entity.Services</value>
<value>com.yilainetwork.entity.ServicesDetailed</value>
<value>com.yilainetwork.entity.WebTransferHistory</value>
</list>
</property>
</bean>
<bean id="bSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
<property name="dataSource">
<ref bean="bDataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.yilainetwork.entity.User</value>
<value>com.yilainetwork.entity.Department</value>
<value>com.yilainetwork.entity.Orders</value>
<value>com.yilainetwork.entity.OrdersProducts</value>
<value>com.yilainetwork.entity.OrdersStatus</value>
<value>com.yilainetwork.entity.Products</value>
<value>com.yilainetwork.entity.ProductsCategory</value>
<value>com.yilainetwork.entity.WebDatabase</value>
<value>com.yilainetwork.entity.ReadOrdersLog</value>
<value>com.yilainetwork.entity.Company</value>
<value>com.yilainetwork.entity.DeliverOrder</value>
<value>com.yilainetwork.entity.Currencies</value>
<value>com.yilainetwork.entity.OrdersStatusHistory</value>
<value>com.yilainetwork.entity.OrdersCommentHistory</value>
<value>com.yilainetwork.entity.EmailWeb</value>
<value>com.yilainetwork.entity.Customers</value>
<value>com.yilainetwork.entity.StatisticsIp</value>
<value>com.yilainetwork.entity.Configuration</value>
<value>com.yilainetwork.entity.Services</value>
<value>com.yilainetwork.entity.ServicesDetailed</value>
<value>com.yilainetwork.entity.WebTransferHistory</value>
</list>
</property>
</bean>
<bean id="cSessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" >
<property name="dataSource">
<ref bean="cDataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.yilainetwork.entity.User</value>
<value>com.yilainetwork.entity.Department</value>
<value>com.yilainetwork.entity.Orders</value>
<value>com.yilainetwork.entity.OrdersProducts</value>
<value>com.yilainetwork.entity.OrdersStatus</value>
<value>com.yilainetwork.entity.Products</value>
<value>com.yilainetwork.entity.ProductsCategory</value>
<value>com.yilainetwork.entity.WebDatabase</value>
<value>com.yilainetwork.entity.ReadOrdersLog</value>
<value>com.yilainetwork.entity.Company</value>
<value>com.yilainetwork.entity.DeliverOrder</value>
<value>com.yilainetwork.entity.Currencies</value>
<value>com.yilainetwork.entity.OrdersStatusHistory</value>
<value>com.yilainetwork.entity.OrdersCommentHistory</value>
<value>com.yilainetwork.entity.EmailWeb</value>
<value>com.yilainetwork.entity.Customers</value>
<value>com.yilainetwork.entity.StatisticsIp</value>
<value>com.yilainetwork.entity.Configuration</value>
<value>com.yilainetwork.entity.Services</value>
<value>com.yilainetwork.entity.ServicesDetailed</value>
<value>com.yilainetwork.entity.WebTransferHistory</value>
</list>
</property>
</bean>
</beans>
<bean id="sessionFactory" class="com.yilainetwork.dao.MultiSessionFactory">
<property name="sessionFactory">
<ref bean="aSessionFactory" />
</property>
</bean>

<!-- dao bean begin -->
<bean id="dao" class="com.yilainetwork.dao.CommonDao">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>

<!-- service beans begin -->
<bean id="baseService" class="com.yilainetwork.service.impl.BaseService" abstract="true" >
<property name="dao">
<ref bean="dao" />
</property>
</bean>

<bean id="ordersService" class="com.yilainetwork.service.impl.OrdersService" parent="baseService"></bean>

<!-- 事务管理 -->
<!-- Transaction beans start -->
<!-- 数据源1事务托管 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref bean="aSessionFactory" />
</property>
</bean>



<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="sav*" propagation="REQUIRED"/>
<tx:method name="dele*" propagation="REQUIRED"/>
<tx:method name="inse*" propagation="REQUIRED"/>
<tx:method name="upda*" propagation="REQUIRED"/>
<tx:method name="*" read-only="true"/>
</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="allManagerMethod" expression="execution(* com.**.dao.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allManagerMethod"/>
</aop:config>
<!-- Transaction beans end -->
gwy13620867 2010-12-26
  • 打赏
  • 举报
回复
切换数据库

Spring 配置
	
<bean id="aDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://localhost:3306/yilainetwork?characterEncoding=utf-8"></property>
<property name="user" value="*****"></property>
<property name="password" value="*****"></property>
<property name="minPoolSize" value="5" ></property>
<property name="maxPoolSize" value="10"></property>
<property name="maxIdleTime" value="25000"></property>
<property name="acquireIncrement" value="1"></property>
<property name="maxStatements" value="0"></property>
<property name="initialPoolSize" value="40"></property>
<property name="idleConnectionTestPeriod" value="18000"></property>
<property name="acquireRetryAttempts" value="10"></property>
<property name="breakAfterAcquireFailure" value="false"></property>
<property name="acquireRetryDelay" value="1000"></property>
<property name="testConnectionOnCheckin" value="true"></property>
<property name="testConnectionOnCheckout" value="true"></property>
<property name="preferredTestQuery" value="select now() as now"></property>
</bean>

<bean id="bDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://*****:3306/yilainetwork?characterEncoding=utf-8"></property>
<property name="user" value="**********"></property>
<property name="password" value="*****"></property>
<property name="minPoolSize" value="5" ></property>
<property name="maxPoolSize" value="10"></property>
<property name="maxIdleTime" value="25000"></property>
<property name="acquireIncrement" value="1"></property>
<property name="maxStatements" value="0"></property>
<property name="initialPoolSize" value="40"></property>
<property name="idleConnectionTestPeriod" value="18000"></property>
<property name="acquireRetryAttempts" value="10"></property>
<property name="breakAfterAcquireFailure" value="false"></property>
<property name="acquireRetryDelay" value="1000"></property>
<property name="testConnectionOnCheckin" value="true"></property>
<property name="testConnectionOnCheckout" value="true"></property>
<property name="preferredTestQuery" value="select now() as now"></property>
</bean>

<bean id="cDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" >
<property name="driverClass" value="com.mysql.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://*****:3306/yilainetwork?characterEncoding=utf-8"></property>
<property name="user" value="***************"></property>
<property name="password" value="**********"></property>
<property name="minPoolSize" value="5" ></property>
<property name="maxPoolSize" value="10"></property>
<property name="maxIdleTime" value="25000"></property>
<property name="acquireIncrement" value="1"></property>
<property name="maxStatements" value="0"></property>
<property name="initialPoolSize" value="40"></property>
<property name="idleConnectionTestPeriod" value="18000"></property>
<property name="acquireRetryAttempts" value="10"></property>
<property name="breakAfterAcquireFailure" value="false"></property>
<property name="acquireRetryDelay" value="1000"></property>
<property name="testConnectionOnCheckin" value="true"></property>
<property name="testConnectionOnCheckout" value="true"></property>
<property name="preferredTestQuery" value="select now() as now"></property>
</bean>

25,980

社区成员

发帖
与我相关
我的任务
社区描述
高性能WEB开发
社区管理员
  • 高性能WEB开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧