Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我们使用的是 hibernate3 jar 和 JDK 6。对于连接池,我们使用的是 UCP-11.2.0.3。现在我们面临连接池已满的问题。我们已经设置了放弃限制。我们想在 UCP 上实现查询超时。这是否可以在 DataSource 级别处理以使查询超时。我可以看到功能datasource.setConnectionProperty(name, value),但没有找到查询超时的属性。
datasource.setConnectionProperty(name, value)
您可以为 UCP 设置的属性在文档中定义
您可以设置Time-To-Live Connection Timeout,这将限制从池中借用连接的总时间。
pds.setTimeToLiveConnectionTimeout(18000)
查询超时可以在语句级别上设置,并且仅对该语句有效 -请参见此处- 所以这不是通过 UCP 配置的。
stmt.setQueryTimeout(timeout)