MyBatis version

3.5.x

Database vendor and version

mysql 8

Test case or example project

since Mybatis 3.5.x, SimpleExecutor.doQueryCursor use Statement.closeOnCompletion to close Statement when in Mybatis 3.4.x,the Statement is closed in DefaultCursor close function

when open the server prepareStatement in mysql(jdbc set useServerPrepStmts=true),closeOnCompletion cannot release mysql server resource, So result in server memory leak.

I think mybe this is mysql jdbc driver's bug, but I don't konw why to use closeOnCompletion instead of close,can mybatis to fix the bug ?

Steps to reproduce

Expected result

Actual result

Comment From: harawata

Please report it to https://bugs.mysql.com/report.php (post the issue URL here so that we can track it). You should attach a repro or the exact steps to reproduce the problem.

closeOnCompletion substantially simplifies the implementation.

Comment From: wanshiliuyun

@yanghanqi have you solve the bug ? we meet the same bug.

Comment From: harawata

@yanghanqi ,

Did you submit a bug report to MySQL? I couldn't find any relevant issue on https://bugs.mysql.com/

@yanghanqi @wanshiliuyun

If either of you could provide a small demo project that reproduces the problem, I would look into it. You can find project templates and examples in this repo: https://github.com/harawata/mybatis-issues

Comment From: wanshiliuyun

@harawata I have report a bug to MySQL with a Java jdbc demo please ref: http://bugs.mysql.com/113509

Comment From: harawata

The MySQL issue seems to have been fixed in Connector/J 9.1.0. Thank you @yanghanqi @wanshiliuyun !