Bug #85885 resultSetConcurrency and resultSetType are swapped in call to prepareStatement
Submitted: 10 Apr 2017 16:54 Modified: 14 Jul 2017 21:45
Reporter: Andrew Rice Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.41 OS:Any
Assigned to: Filipe Silva CPU Architecture:Any

[10 Apr 2017 16:54] Andrew Rice
Description:
In com/mysql/jdbc/ServerPreparedStatement.java on line 2783 the call to prepareStatement has resultSetConcurrency and resultSetType the wrong way round.

We found this bug whilst writing a new analysis check for http://errorprone.info

How to repeat:
The line reads:

PreparedStatement pstmt = ((Wrapper) localConn.prepareStatement(this.parseInfo.getSqlForBatch(numBatches), this.resultSetConcurrency,
                        this.resultSetType)).unwrap(PreparedStatement.class);

Suggested fix:
The line should read:

PreparedStatement pstmt = ((Wrapper) localConn.prepareStatement(this.parseInfo.getSqlForBatch(numBatches), this.resultSetType,                     this.resultSetConcurrency)).unwrap(PreparedStatement.class);
[11 Apr 2017 7:59] Chiranjeevi Battula
Hello Andrew Rice,

Thank you for the bug report.
Verified based on internal discussion with dev's.

Thanks,
Chiranjeevi.
[14 Jul 2017 21:45] Daniel So
Posted by developer:
 
Added the following entry to the Connector/J 5.1.43 changelog:

"In com/mysql/jdbc/ServerPreparedStatement.java, the arguments resultSetType and resultSetConcurrency for a call of Connection.preparedStatement() were swapped. "
[29 Aug 2017 20:06] Daniel So
Posted by developer:
 
Added the changelog entry for Connector/J 8.0.8.