Bug #112784 getHoldability() and getResultSetHoldability() return different results

Submitted: 20 Oct 2023 14:34 Modified: 21 May 2025 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 2025 6:10] Axyoan Marcelo
Duplicate of Bug#44791

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.