bonecp.properties

jdbc.driverClass=oracle.jdbc.driver.OracleDriver
jdbc.jdbcUrl=jdbc:oracle:thin:@192.168.30.4:1521:test
jdbc.username=test
jdbc.password=test #Sets the minimum number of connections that will be contained in every partition.
bonecp.minConnectionsPerPartition=1
#Sets the maximum number of connections that will be contained in every partition.
#Setting this to 5 with 3 partitions means you will have 15 unique
#connections to the database. Note that the connection pool will not create all
#these connections in one go but rather start off with minConnectionsPerPartition and gradually
#increase connections as required.
bonecp.maxConnectionsPerPartition=5
#Sets the acquireIncrement property. When the available connections are about to run
#out, BoneCP will dynamically create new ones in batches. This property controls how
#many new connections to create in one go (up to a maximum of
#maxConnectionsPerPartition). Note: This is a per partition setting.
bonecp.acquireIncrement=1
#Sets number of partitions to use. In order to reduce lock contention
#and thus improve performance, each incoming connection request picks off a connection from
#a pool that has thread-affinity, i.e. pool[threadId % partition_count]. The higher this number,
#the better your performance will be for the case when you have plenty
#of short-lived threads. Beyond a certain threshold, maintenance of these pools will start
#to have a negative effect on performance (and only for the case when
#connections on a partition start running out). Default: 1, minimum: 1, recommended:
#2-4 (but very app specific)
bonecp.partitionCount=1
#Sets the idleConnectionTestPeriod. This sets the time (in minutes), for a connection
#to remain idle before sending a test query to the DB. This is
#useful to prevent a DB from timing out connections on its end. Do
#not use aggressive values here! Default: 240 min, set to 0
#to disable
bonecp.idleConnectionTestPeriodInMinutes=240
#Sets the idleConnectionTestPeriod. This sets the time (in seconds), for a connection
#to remain idle before sending a test query to the DB. This is
#useful to prevent a DB from timing out connections on its end. Do
#not use aggressive values here! Default: 240 min, set to 0
#to disable
bonecp.idleConnectionTestPeriodInSeconds=14400
#Sets Idle max age (in min). The time (in minutes), for a
#connection to remain unused before it is closed off. Do not use aggressive
#values here! Default: 60 minutes, set to 0 to disable.
bonecp.idleMaxAgeInMinutes=60
#Sets Idle max age (in seconds). The time (in seconds), for a
#connection to remain unused before it is closed off. Do not use aggressive
#values here! Default: 60 minutes, set to 0 to disable.
bonecp.idleMaxAgeInSeconds=3600
#Sets statementsCacheSize setting. The number of statements to cache.
bonecp.statementsCacheSize=0
#Sets number of helper threads to create that will handle releasing a connection.
#When this value is set to zero, the application thread is blocked
#until the pool is able to perform all the necessary cleanup to recycle
#the connection and make it available for another thread. When a non-zero
#value is set, the pool will create threads that will take care of
#recycling a connection when it is closed (the application dumps the connection into
#a temporary queue to be processed asychronously to the application via the release
#helper threads). Useful when your application is doing lots of work on
#each connection (i.e. perform an SQL query, do lots of non-DB stuff and
#perform another query), otherwise will probably slow things down.
bonecp.releaseHelperThreads=3
#Instruct the pool to create a helper thread to watch over connection acquires
#that are never released (or released twice). This is for debugging purposes only
#and will create a new thread for each call to getConnection(). Enabling this
#option will have a big negative impact on pool performance.
bonecp.closeConnectionWatch=false
#If enabled, log SQL statements being executed.
bonecp.logStatementsEnabled=false
#Sets the number of ms to wait before attempting to obtain a connection
#again after a failure.
bonecp.acquireRetryDelayInMs=7000
#Set to true to force the connection pool to obtain the initial connections
#lazily.
bonecp.lazyInit=false
#Set to true to enable recording of all transaction activity and replay the
#transaction automatically in case of a connection failure.
bonecp.transactionRecoveryEnabled=false
#After attempting to acquire a connection and failing, try to connect these many
#times before giving up. Default 5.
bonecp.acquireRetryAttempts=5
#Set to true to disable JMX.
bonecp.disableJMX=false
#Queries taking longer than this limit to execute are logged.
bonecp.queryExecuteTimeLimitInMs=0
#Sets the Pool Watch thread threshold. The pool watch thread attempts to
#maintain a number of connections always available (between minConnections and maxConnections). This value
#sets the percentage value to maintain. For example, setting it to 20 means
#that if the following condition holds: Free Connections / MaxConnections < poolAvailabilityThreshold
#new connections will be created. In other words, it tries to keep at
#least 20% of the pool full of connections. Setting the value to zero
#will make the pool create new connections when it needs them but it
#also means your application may have to wait for new connections to be
#obtained at times. Default: 20.
bonecp.poolAvailabilityThreshold=20
#If set to true, the pool will not monitor connections for proper closure.
#Enable this option if you only ever obtain your connections via a mechanism
#that is guaranteed to release the connection back to the pool (eg Spring's
#jdbcTemplate, some kind of transaction manager, etc).
bonecp.disableConnectionTracking=false
#Sets the maximum time (in milliseconds) to wait before a call to getConnection
#is timed out. Setting this to zero is similar to setting it
#to Long.MAX_VALUE Default: 0 ( = wait forever )
bonecp.connectionTimeoutInMs=0
#Sets the no of ms to wait when close connection watch threads are
#enabled. 0 = wait forever.
bonecp.closeConnectionWatchTimeoutInMs=0
#Sets number of statement helper threads to create that will handle releasing a
#statement. When this value is set to zero, the application thread is
#blocked until the pool and JDBC driver are able to close off the
#statement. When a non-zero value is set, the pool will create threads
#that will take care of closing off the statement asychronously to the application
#via the release helper threads). Useful when your application is opening up
#lots of statements otherwise will probably slow things down.
bonecp.statementReleaseHelperThreads=0
#Sets the maxConnectionAge in seconds. Any connections older than this setting will be
#closed off whether it is idle or not. Connections currently in use will
#not be affected until they are returned to the pool.
bonecp.maxConnectionAgeInSeconds=0
#If set to true, keep track of some more statistics for exposure via
#JMX. Will slow down the pool operation.
bonecp.statisticsEnabled=false
#If set to true, no attempts at passing in a username/password will be
#attempted when trying to obtain a raw (driver) connection. Useful for cases when
#you already have another mechanism on authentication eg NTLM.
bonecp.externalAuth=false

applicationContenxt.xml

<!-- 载入properties文件 -->
<bean id="propertyConfigurer"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:cn/com/config/dataSource/bonecp.properties</value>
</list>
</property>
</bean>
<!--配置数据源 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<ref local="boneCPDataSource" />
</property>
</bean> <bean id="boneCPDataSource" class="com.jolbox.bonecp.BoneCPDataSource"
destroy-method="close">
<!-- BoneCP type -->
<property name="driverClass" value="${jdbc.driverClass}" />
<property name="jdbcUrl" value="${jdbc.jdbcUrl}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" /> <property name="minConnectionsPerPartition" value="${bonecp.minConnectionsPerPartition}" />
<property name="maxConnectionsPerPartition" value="${bonecp.maxConnectionsPerPartition}" />
<property name="partitionCount" value="${bonecp.partitionCount}" />
<property name="acquireIncrement" value="${bonecp.acquireIncrement}" />
<property name="statementsCacheSize" value="${bonecp.statementsCacheSize}" />
<property name="releaseHelperThreads" value="${bonecp.releaseHelperThreads}" />
</bean>

版权声明:本文博客原创文章,博客,未经同意,不得转载。

bonecp使用数据源的更多相关文章

  1. 为什么HikariCP被号称为性能最好的Java数据库连接池,怎样配置使用

    HiKariCP是数据库连接池的一个后起之秀.号称性能最好.能够完美地PK掉其它连接池. 原文地址:http://blog.csdn.net/clementad/article/details/469 ...

  2. Play 起步

    *****************jdk下载地址: http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.ta ...

  3. MySql8.0数据库链接报错The driver has not received any packets from the server

    1.我使用MySql数据库8.0版本,然后驱动改成了 jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.url=jdbc:mysql://127.0.0.1:3306 ...

  4. 为什么HikariCP被号称为性能最好的Java数据库连接池,如何配置使用

    转自:https://blog.csdn.net/clementad/article/details/46928621 HiKariCP是数据库连接池的一个后起之秀,号称性能最好,可以完美地PK掉其他 ...

  5. [转帖]为什么HikariCP被号称为性能最好的Java数据库连接池,如何配置使用

    为什么HikariCP被号称为性能最好的Java数据库连接池,如何配置使用 原创Clement-Xu 发布于2015-07-17 15:53:14 阅读数 57066  收藏 展开 HiKariCP是 ...

  6. Spring 管理数据源

    Spring 管理数据源 不管通过何种持久化技术,都必须通过数据连接访问数据库,在Spring中,数据连接是通过数据源获得的.在以往的应用中,数据源一般是Web应用服务器提供的.在Spring中,你不 ...

  7. DBCP、C3P0、Proxool 、 BoneCP开源连接池的比《转》

     简介   使用评价  项目主页  DBCP DBCP是一个依赖Jakarta commons-pool对象池机制的数据库连接池.DBCP可以直接的在应用程序用使用 可以设置最大和最小连接,连接等待时 ...

  8. 开源DBCP、C3P0、Proxool 、 BoneCP连接池的比较

    简介 项目主页 使用评价  DBCP DBCP是一个依赖Jakarta commons-pool对象池机制的数据库连接池.DBCP可以直接的在应用程序用使用 http://homepages.nild ...

  9. JAVA数据源连接方式汇总

    最近在研究JAVA的数据源连接方式,学习的时候发现了一位同行写的文章,转载过来,留作记录! 一.问题引入 在java程序中,需要访问数据库,做增删改查等相关操作.如何访问数据库,做数据库的相关操作呢? ...

随机推荐

  1. Linux查看进程线程个数

    1.根据进程号进行查询: # pstree -p 进程号 # top -Hp 进程号 2.根据进程名字进行查询: # pstree -p `ps -e | grep server | awk '{pr ...

  2. Windows Phone开发(26):启动器与选择器之MediaPlayerLauncher和SearchTask

    原文:Windows Phone开发(26):启动器与选择器之MediaPlayerLauncher和SearchTask 启动器与选择器简单的地方在于,它们的使用方法几乎一模一样,从前面几节中,我相 ...

  3. 大爱jQuery,10美女模特有用jQuery/CSS3插入(集成点免费下载)

    整合下载地址:http://download.csdn.net/detail/yangwei19680827/7343001 jQuery真的是一款非常犀利的Javascript框架,利用jQuery ...

  4. USACO comehome Dijkstra

    USER: Kevin Samuel [kevin_s1] TASK: comehome LANG: C++ Compiling... Compile: OK Executing... Test 1: ...

  5. zabbix通过脚本发送短信

    zabbix通过脚本发送短信 原则 和zabbix电子邮件是一样的,他们是action内部配置,司的api来完毕.当然网上有不少利用139邮箱来发的,这个事实上算调用email的一种,这里复述的是调用 ...

  6. NET MVC异常处理模块

    一个简单的ASP.NET MVC异常处理模块   一.前言 异常处理是每个系统必不可少的一个重要部分,它可以让我们的程序在发生错误时友好地提示.记录错误信息,更重要的是不破坏正常的数据和影响系统运行. ...

  7. Gradle第二步骤来创建学习Task

    请下载本系列中的以下文章Github演示示例代码: git clone https://github.com/davenkin/gradle-learning.git     Gradle的Proje ...

  8. 【Jqurey EasyUI+Asp.net】---DataGrid增加、删、更改、搜

    在前面写了两,但不知道如何完成,对比刚刚开始学这个,他们摸着石头过河,一步步.在最后两天DataGridCRUD融合在一起.因此份额.我希望像我这样谁是刚刚开始学习一些帮助. 直接主题酒吧. 它是说数 ...

  9. HDU 4313 Matrix

    水题:在一个双连通的树上有一些点很有破坏性,我们要把这些带破环性的点隔开,就是破坏一些边使这些点之间不连通,破坏一条边需要一点时间,问最少需要多少时间(同一时间只能破坏一个地方,且忽略位置转移的时间) ...

  10. Linux curl使用简单介绍 (转)

    Curl是Linux下一个很强大的http命令行工具,其功能十分强大. 1) 二话不说,先从这里开始吧! $ curl http://www.linuxidc.com 回车之后,www.linuxid ...