简体   繁体   English

在 spring 应用程序中设置查询超时连接时遇到问题

[英]Troubles setting up query time-out connection in spring application

I'm having issues setting up the query time out of my application.我在从我的应用程序中设置查询时间时遇到问题。 I'm using spring-boot, we implemented a Jdbc template to handle the connections (connections pool, Hikari, disabled).我正在使用 spring-boot,我们实现了一个 Jdbc 模板来处理连接(连接池、Hikari、禁用)。 I've tried setting up the query time-out connection in my DataSource configuration by:我尝试通过以下方式在我的 DataSource 配置中设置查询超时连接:

jdbcTemplate.setQueryTimeout(10); jdbcTemplate.setQueryTimeout(10);

This didn't work although I realized that the set has been done when I debugged the application.这没有用,尽管我在调试应用程序时意识到设置已经完成。 It seems to that the query time-out is disabled because I used a SLEEP call in my query waiting around 5 minutes and I did not get a query time-out exception.查询超时似乎被禁用,因为我在查询中使用了一个 SLEEP 调用,等待了大约 5 分钟,但我没有收到查询超时异常。 I was thinking maybe on some DB2 driver configuration property overriding my connection configuration.我在想也许某些 DB2 驱动程序配置属性会覆盖我的连接配置。

The queryTimeout setting is not supported by the DB2 driver, https://www.ibm.com/support/pages/how-configure-query-timeout-data-server-driver-jdbc . DB2 驱动程序https://www.ibm.com/support/pages/how-configure-query-timeout-data-server-driver-jdbc不支持 queryTimeout 设置。

Set the DB2 connection property blockingReadConnectionTimeout to timeout.将 DB2 连接属性 blockingReadConnectionTimeout 设置为超时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM