DBCP连接池loginTimeout [英] DBCP Connection Pool loginTimeout

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

问题描述

根据 DBCP文档,BasicDataSource不支持setLoginTimeout()。我的问题是,然后如何设置一个LoginTimeout创建Connection对象?我知道我可以在池上设置maxWait,但我的理解是,只有当池被用尽,你正在等待一个现有的连接释放。它不会保存我需要创建一个新的连接,但连接/登录到DB挂起的情况。

According to the DBCP Document, BasicDataSource does not support setLoginTimeout(). My question is then how do I set a LoginTimeout for the creation of Connection objects? I know I can set maxWait on the pool, but my understanding is that that'll only be used for when the pool is exhausted and you're waiting for an existing connection to free up. It will not save me from the situation where a new connection needs to be created, but the connection/login into the DB hangs.

任何帮助是赞赏。非常感谢。

Any help is appreciated. Thanks.

推荐答案

总是有一个选项可以为URL添加正确的参数。根据您使用的数据库,您可以在JDBC网址中添加其中一个参数。

Well there is always an option to add correct parameter to the URL. Depending on which DB you are using you can add one of the parameters in JDBC url.

这里是链接,确认BasicDataSource不支持loginTimeout

Here is the link that confirms that BasicDataSource does not support loginTimeout

在这个博客的底部有一个表列出连接超时的网址参数。

And at the bottom of this blog There is a table which lists URL parameters for connection timeouts.

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

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