1. 首先是jdbc.properties属性文件的编写,便于数据库移植:

datasource.driverClassName=oracle.jdbc.driver.OracleDriver
datasource.url=jdbc:oracle:thin:@10.6.1.11:1521:student

datasource.username=zs
datasource.password=zs

datasource.defaultAutoCommit=true 
hibernate.dialect=org.hibernate.dialect.Oracle9Dialect


#当连接池中的连接耗尽的时候c3p0一次同时获取的连接数。Default: 3
c3p0.acquireIncrement=5
#初始化时获取三个连接,取值应在minPoolSize与maxPoolSize之间。Default: 3 
c3p0.initialPoolSize=10
#每60秒检查所有连接池中的空闲连接。Default: 0 
c3p0.idleConnectionTestPeriod=600
#-连接池中保留的最小连接数。
c3p0.minPoolSize=5
#连接池中保留的最大连接数。Default: 15 
c3p0.maxPoolSize=50
#JDBC的标准参数,用以控制数据源内加载的PreparedStatements数量。但由于预缓存的statements
#属于单个connection而不是整个连接池。所以设置这个参数需要考虑到多方面的因素。
#如果maxStatements与maxStatementsPerConnection均为0,则缓存被关闭。Default: 0
c3p0.maxStatements=100
#c3p0是异步操作的,缓慢的JDBC操作通过帮助进程完成。扩展这些操作可以有效的提升性能
#通过多线程实现多个操作同时被执行。Default: 3
c3p0.numHelperThreads=10
#最大空闲时间,60秒内未使用则连接被丢弃。若为0则永不丢弃。Default: 0 
c3p0.maxIdleTime=600


#hibernate.dialect=org.hibernate.dialect.SQLServerDialect
hibernate.jdbc.batch_size=25
hibernate.jdbc.fetch_size=50
hibernate.show_sql=true
hibernate.connection.release_mode=after_transaction

 

2. 其次是spring配置文件的数据源配置:

<bean >
      <value>/WEB-INF/classes/conf/jdbc/jdbc.properties</value>
   </property>
</bean>


<bean >
      <value>${c3p0.numHelperThreads}</value>
   </property>
</bean>

相关文章:

  • 2022-01-04
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-22
  • 2021-09-22
猜你喜欢
  • 2022-01-04
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案