c3p0连接池查询 [英] c3p0 connection pool queries

查看:97
本文介绍了c3p0连接池查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用c3p0连接池,并且我有minPoolSize = 1 maxPoolSize = 5和InitialPoolSize = 5。

I am using c3p0 connection pool and I have minPoolSize=1 maxPoolSize=5 and InitialPoolSize=5.

服务器启动时,我可以看到它有5个连接。但是随着第一个请求的到来,那没有。增加到10。从那以后,由于这10个连接正在处理该负载,它保持10。现在我的问题是,即使maxPoolSize为5,为什么还要创建另一个5 conn。在游泳池。是因为initialPoolSize吗?

When server starts, i can see it is having 5 connection. But as the first request came, that no. increases to 10. And from then onwards it stays 10 as those 10 connections are handling that load. Now my question is, even if maxPoolSize is 5 , why it is creating another 5 conn. in the pool. Is it because of initialPoolSize ?

谢谢

推荐答案

您有两个活动池。您是在调用getConnection(user,password)而不是默认的getConnection()吗? c3p0为每个身份验证创建一个不同的池。另外,您可以通过JMX跟踪活动身份验证的次数。

it sounds like you have two active pools. are you calling getConnection( user, password ) rather than the default getConnection()? c3p0 creates a distinct pool for each authentication. also, you can follow the number of active authentications via JMX.

initialPoolSize应该与它无关。同样,在尝试了解c3p0问题时,始终要确保活动配置符合您的期望,这始终是一个好主意。再次,您可以通过JMX查看大多数配置参数,或更简单地,检查您的日志文件。 c3p0数据源在初始化时将其配置转储到INFO。

initialPoolSize shouldn't have anything much to do with it. also, it's always a good idea, when trying to understand c3p0 issues, to make sure that the active config is what you expect it is. again, you can see most config parameters via JMX, or more simply, check your log files. c3p0 DataSources dump their configuration at INFO upon initialization.

这篇关于c3p0连接池查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆