Bug #112784 getHoldability() and getResultSetHoldability() return different results
Submitted: 20 Oct 2023 14:34 Modified: 21 May 6:10
Reporter: Wenqian Deng Email Updates:
Status: Duplicate Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:8.1.0, 8.0.33 OS:Any
Assigned to: CPU Architecture:Any

[20 Oct 2023 14:34] Wenqian Deng
Description:
Hi there, I find that when I obtain a new Statement object, the ResultSetHoldability it retrieves is 1. 
However, when I create a ResultSet using this Statement and try to get its Holdability value, it throws an error. I find this confusing because I expect these two methods to behave consistently.

How to repeat:
@Test
public void test() throws SQLException {
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test?user=user&password=password");
    Statement stmt = con.createStatement(1003, 1008, 1);
    System.out.println(stmt.getResultSetHoldability());
    ResultSet rs = stmt.executeQuery("SELECT 1;");
    System.out.println(rs.getHoldability()); // expect return the same results as stmt.getResultSetHoldability() 
}
[23 Oct 2023 7:22] MySQL Verification Team
Hello Wenqian Deng,

Thank you for the report and test case.
Verified as described.

regards,
Umesh Shastry
[21 May 6:10] Axyoan Marcelo
Duplicate of Bug#44791