Hibernate,连接数据库,spring配置问题?
我写了个程序,是连接本地数据库,spring的配置如下.
<bean id="dataSourceBakSf" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="jdbcUrl">
<value>jdbc:mysql://127.0.0.1:3306/salesforce?characterEncoding=UTF-8</value>
</property>
<property name="user">
<value>root</value>
</property>
<property name="password">
<value>111111</value>
</property>
<property name="minPoolSize" value="3" />
<property name="maxPoolSize" value="30" />
<property name="maxIdleTime" value="28000" />
<property name="acquireIncrement" value="3" />
<property name="maxStatements" value="0" />
<property name="initialPoolSize" value="3" />
<property name="idleConnectionTestPeriod" value="28000" />
<property name="acquireRetryAttempts" value="30" />
<property name="breakAfterAcquireFailure" value="true" />
<property name="testConnectionOnCheckout" value="false" />
程序是从其他地方获取数据,写到数据库里,因为数据量很大,所以跑的时间比较长,现在的问题就是跑了,一段时间后就出错.
刚开始超时,然后我加了这个
<!--<property name="checkoutTimeout" value="3000000"/>
又报其他错误,
怎么修改,都不能一直没错的跑下去,
报的错错误如下 ,希望大家给看看,是那里出的问题啊。
Update Exception; nested exception is:
java.net.ConnectException: Connection timed out: connect Mon May 25 13:43:22 GMT+08:00 2009
Update ExceptionPremature end of file.
Mon May 25 18:23:16 GMT+08:00 2009
///////////////////////////////////////////////////////////////////
2009-06-09 07:51:34,968 [org.quartz.core.JobRunShell]-[ERROR] Job DEFAULT.baktosfJobDetail threw an unhandled Exception:
java.lang.OutOfMemoryError: Java heap space
2009-06-09 07:51:34,968 [org.quartz.core.ErrorLogger]-[ERROR] Job (DEFAULT.baktosfJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.OutOfMemoryError: Java heap space]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: java.lang.OutOfMemoryError: Java heap space
////////////////////////////////////////////////////////////////
2009-06-10 01:14:11,375 [org.quartz.core.JobRunShell]-[ERROR] Job DEFAULT.baktosfJobDetail threw an unhandled Exception:
java.lang.OutOfMemoryError: Java heap space
2009-06-10 01:14:13,312 [org.quartz.core.ErrorLogger]-[ERROR] Job (DEFAULT.baktosfJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: java.lang.OutOfMemoryError: Java heap space]
at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: java.lang.OutOfMemoryError: Java heap space
///////////////////////////////////////////////////////////////
Update Exception; nested exception is:
java.net.SocketException: Connection reset Wed Jun 10 15:34:09 GMT+08:00 2009
//////////////////////
Update Exception; nested exception is:
java.net.SocketException: Connection reset Thu Jun 11 22:23:56 GMT+08:00 2009
2009-06-11 22:36:19,171 [com.mchange.v2.resourcepool.BasicResourcePool]-[WARN] BasicResourcePool: An idle resource is broken and will be purged.
java.sql.SQLException: Connection is invalid
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.testPooledConnection(C3P0PooledConnectionPool.java:196)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.refurbishIdleResource(C3P0PooledConnectionPool.java:136)
at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1394)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:368)
2009-06-11 22:36:19,171 [com.mchange.v2.resourcepool.BasicResourcePool]-[WARN] BasicResourcePool: An idle resource is broken and will be purged.
java.sql.SQLException: Connection is invalid
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.testPooledConnection(C3P0PooledConnectionPool.java:196)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1.refurbishIdleResource(C3P0PooledConnectionPool.java:136)
at com.mchange.v2.resourcepool.BasicResourcePool$AsyncTestIdleResourceTask.run(BasicResourcePool.java:1394)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:368)
2009-06-11 22:36:19,171 [com.mchange.v2.resourcepool.BasicResourcePool]-[WARN] BasicResourcePool: An idle resource is broken and will be purged.
java.sql.SQLException: Connection is invalid
/////////////////////
Update Exception; nested exception is:
java.net.SocketTimeoutException: Read timed out Fri Jun 12 11:16:52 GMT+08:00 2009