From 049b6cf49e185b376bfd1177c9ca8058c5f3ad8c Mon Sep 17 00:00:00 2001 From: wang_hong <1337151114@qq.com> Date: Tue, 25 May 2021 20:44:56 +0800 Subject: [PATCH] Fix for Bug#103796,Connector/J 8 stmt setQueryTimeout can not work when use cursor fix Connector/J 8 stmt setQueryTimeout can not work when use cursor --- src/main/user-impl/java/com/mysql/cj/jdbc/StatementImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/user-impl/java/com/mysql/cj/jdbc/StatementImpl.java b/src/main/user-impl/java/com/mysql/cj/jdbc/StatementImpl.java index d340e2f7c..b1369c7c2 100644 --- a/src/main/user-impl/java/com/mysql/cj/jdbc/StatementImpl.java +++ b/src/main/user-impl/java/com/mysql/cj/jdbc/StatementImpl.java @@ -553,6 +553,10 @@ private ResultSetInternalMethods createResultSetUsingServerFetch(String sql) thr java.sql.PreparedStatement pStmt = this.connection.prepareStatement(sql, this.query.getResultType().getIntValue(), this.resultSetConcurrency); pStmt.setFetchSize(this.query.getResultFetchSize()); + + if (this.getQueryTimeout() > 0) { + pStmt.setQueryTimeout(this.getQueryTimeout()); + } if (this.maxRows > -1) { pStmt.setMaxRows(this.maxRows);