Bug #118095 Different results when getting ResultSet Holdability
Submitted: 30 Apr 10:44 Modified: 5 May 18:11
Reporter: 策 吕 Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:9.1.0, 9.3.0 OS:Any
Assigned to: CPU Architecture:Any

[30 Apr 10:44] 策 吕
Description:
In one of my attempts, I found a serious problem that was producing results as expected on other vendors' database connectors, but triggered an exception on the MYSQL Connector/J.

When "System.out.println(rs.getHoldability());" I was expecting result 1, but it actually triggered a MYSQL exception. However, I tested it on other vendor's database connectors(e.g. OceanBase Connector/J) and found no problem, and it successfully returned the result I was expecting: 1.

How to repeat:
import java.sql.*;

public class test {
    public static void main(String[] args) throws SQLException {
        String url1 = "jdbc:mysql://localhost:3306/test?user=root&password=1234&allowMultiQueries=true";
        String url2 = "jdbc:oceanbase://49.52.27.61:2881/test?user=root@test&password=1234&allowMultiQueries=false";
        Connection con = DriverManager.getConnection(url2);
        Statement stmt = con.createStatement();
        // System.out.println(stmt.getResultSetHoldability()); // Actually return 1.
        ResultSet rs = stmt.executeQuery("SELECT 1;");
        System.out.println(rs.getHoldability()); // expect return 1.
    }
}
[2 May 6:51] MySQL Verification Team
Hello 策 吕,

Thank you for the report and feedback.
Verified as described.

regards,
Umesh
[5 May 18:11] Axyoan Marcelo
Duplicate of Bug#44791