bonecp使用数据源

bonecp使用数据源

大家好,又见面了,我是全栈君,今天给大家准备了Idea注册码。

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>

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/117391.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • IntelliJ IDEA安装教程(超详细)「建议收藏」

    IntelliJ IDEA安装教程(超详细)「建议收藏」IDEA安装教程目录一、JDK的彻底卸载(选做)二、JDK的安装三、IDEA的安装四、IDEA的“扩展”教程五、代码测试六、Error:Cannotdeterminepathto’tools.jar’libraryfor17(D:\jdk-17.0.1)报错的解决方案七、说明写在前面:JDK版本要与IDEA版本相匹配,不然会报错嗷(即:第六节所示)!因为我之前有JDK,所以为了更好的演示,我先把JDK17卸载了。如果你有JDK请查看你的JDK版本后进行第二步(…

    2022年6月26日
    69
  • 一代、二代、三代测序技术原理与比较「建议收藏」

    一代、二代、三代测序技术原理与比较「建议收藏」从1977年第一代DNA测序技术(Sanger法)1,发展至今三十多年时间,测序技术已取得了相当大的发展,从第一代到第三代乃至第四代,测序读长从长到短,再从短到长。虽然就当前形势看来第二代短读长测序技术在全球测序市场上仍然占有着绝对的优势位置,但第三和第四代测序技术也已在这一两年的时间中快速发展着。测序技术的每一次变革,也都对基因组研究,疾病医疗研究,药物研发,育种等领域产生巨大的推动作用。在这里我主要对当前的测序技术以及它们的测序原理做一个简单的小结。

    2022年5月17日
    92
  • B样条曲线拟合原理「建议收藏」

    B样条曲线拟合原理「建议收藏」1.与贝塞尔曲线对比B样条曲线是在Bezier曲线基础上发展起来的一类曲线,它克服了Bezier曲线整体控制性所带来的不便,最常用的是二次和三次B样条曲线。2.二次B样条2.1参数方程已知三个平面离散点P0、P1、P2,由这三点可以定义二次抛物线段,其参数矢量方程形式为:二次B样条曲线参数方程的矩阵形式为:对比着看,

    2022年6月18日
    66
  • Shell 语法

    Shell 语法1、Shell环境hell编程跟java、php编程一样,只要有一个能编写代码的文本编辑器和一个能解释执行的脚本解释器就可以了。Linux的Shell种类众多,常见的有:Bourne

    2022年7月4日
    24
  • C#实现登录界面,密码星号显示(隐藏输入密码)

    C#实现登录界面,密码星号显示(隐藏输入密码)C#实现登录界面,密码星号显示(隐藏输入密码)属性解释代码效果工程在软件设计时,往往需要设置用户的登录权限。用户在填写密码时,如何实现输入隐藏,或者以“*”号进行隐藏显示?这里需要利用textBox的PasswordChar属性。属性解释PasswordChar属性用于获取或设置字符,该字符用于屏蔽单行TextBox控件中的密码字符。代码下面展示了checkBox状态切换响应函数代码privatevoidckBoxPassword_CheckedChanged(objectsend

    2022年7月24日
    75
  • socket中的connect提示报错:errno = “EINPROGRESS“

    socket中的connect提示报错:errno = “EINPROGRESS“socketconnectioctlsocketerror.h#defineEINPROGRESS115/*Operationnowinprogress*/

    2022年7月16日
    16

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号