我通过使用连接
c3p0池解决了这个问题
<bean id="dataSource" destroy-method="close" p:driverClass="${jdbc.driverClassName}" p:jdbcUrl="${jdbc.url}" p:user="${jdbc.username}" p:password="${jdbc.password}" p:preferredTestQuery="select 1 from dual" p:idleConnectionTestPeriod="300" p:maxStatements="100" p:acquireRetryAttempts="1" p:checkoutTimeout="1000" p:testConnectionOnCheckout="true" p:testConnectionOnCheckin="true" p:acquireIncrement="${c3p0.acquire_increment}" p:minPoolSize="${c3p0.min_size}" p:maxPoolSize="${c3p0.max_size}" p:maxIdleTime="${c3p0.max_idle_time}" p:unreturnedConnectionTimeout="${c3p0.unreturned_connection_timeout}" />
DB.properties文件:
#hibernatehibernate.dialect=org.hibernate.dialect.OracleDialecthibernate.hbm2ddl.auto= updatehibernate.connection.autocommit = truehibernate.cache = truehibernate.query.cache = truehibernate.statistics = truehibernate.c3p0.idle_test_period=300#c3p0 poolc3p0.acquire_increment=5c3p0.max_size=100c3p0.min_size=5c3p0.max_idle_time=1200c3p0.unreturned_connection_timeout=120
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)