【问题标题】:Is there any option to terminate the execution of query after 15 seconds? [duplicate]是否有任何选项可以在 15 秒后终止查询的执行? [复制]
【发布时间】:2018-12-31 10:47:08
【问题描述】:
rs = pstmt.executeQuery();

我想在执行查询之前将计时器设置为 15 秒,因为它应该被终止。

【问题讨论】:

    标签: java timer prepared-statement executequery


    【解决方案1】:

    你可以用这个,

    pstmt.setQueryTimeout(15);
    rs = pstmt.executeQuery();
    

    【讨论】:

    • 完成 15 秒后我需要关闭此连接打开其他连接
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-25
    • 2011-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多