Bug #24871 NPE when useCursorFetch and defaultFetchSize is set
Submitted: 7 Dec 2006 2:16 Modified: 7 Dec 2006 13:30
Reporter: Yuan WANG Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:5.0.4 OS:Linux (linux)
Assigned to: CPU Architecture:Any

[7 Dec 2006 2:16] Yuan WANG
Description:
When I set useCursorFetch and defaultFetchSize in the url, e.g. useCursorFetch=true&defaultFetchSize=20, I got the following exception.

java.sql.SQLException: java.lang.NullPointerException
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
	at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:718)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:794)
	at com.mysql.jdbc.Statement.createResultSetUsingServerFetch(Statement.java:505)
	at com.mysql.jdbc.Statement.executeQuery(Statement.java:1096)
	at com.mysql.jdbc.Connection.loadServerVariables(Connection.java:4317)
	at com.mysql.jdbc.Connection.initializePropsFromServer(Connection.java:3936)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:2683)
	at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
	at java.sql.DriverManager.getConnection(DriverManager.java:525)
	at java.sql.DriverManager.getConnection(DriverManager.java:171)
	at com.netease.ddb.perf.SimpleSQLClient.loadConnection(SimpleSQL.java:129)
	at com.netease.ddb.perf.SimpleSQLClient.run(SimpleSQL.java:83)

How to repeat:
set useCursorFetch and defaultFetchSize in the url and connect to any database.
[7 Dec 2006 9:23] Tonci Grgin
Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Explanation: What is the MySQL server version you're using?
useCursorFetch 
If connected to MySQL > 5.0.2, and setFetchSize() > 0 on a statement, should that statement use cursor-based fetching to retrieve rows?
[7 Dec 2006 9:32] Tonci Grgin
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Explanation: This problem is fixed with patch for BUG#24360
nn-nn-06 - Version 5.0.5
    - Fixed BUG#24360 .setFetchSize() breaks prepared SHOW and other commands.

and can't be repeated in my tests.
[7 Dec 2006 13:30] Yuan WANG
The version of mysql server is 5.1.12-beta-debug