Bug #27647 at com.mysql.jdbc.Statement.setMaxRows(Statement.java:467)
Submitted: 4 Apr 2007 13:06 Modified: 31 Mar 2014 12:35
Reporter: anand raj Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:4 OS:Windows
Assigned to: Alexander Soklakov CPU Architecture:Any
Tags: at com.mysql.jdbc.Statement.setMaxRows(Statement.java:467)

[4 Apr 2007 13:06] anand raj
Description:
i got the error like this 
at com.mysql.jdbc.Statement.setMaxRows(Statement.java:467)
i want to know the reason ,solution , please anyone can help me to solve this problem

How to repeat:
i got the error like this 
at com.mysql.jdbc.Statement.setMaxRows(Statement.java:467)
i want to know the reason ,solution , please anyone can help me to solve this problem
[3 May 2007 9:14] Tonci Grgin
Hi Anand and thanks for your report. Please attach small but complete test case showing this error each time it's run. Can you also fill in necessary info like MySQL server version, JDK/JRE version, c/J version, OS details ...
[8 Jun 2007 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[9 Apr 2008 20:42] A. Bakia
Coldfusion 8 uses the driver mysql-connector-java-commercial-5.0.5-bin.jar. I extracted the file c:\coldfusion8\lib\mysql-connector-java-commercial-5.0.5-bin.jar and opened the file Statement.class using a decompiler. The constructor looks like this:

public Statement(com.mysql.jdbc.Connection c, String catalog) throws SQLException
{
cancelTimeoutMutex = new Object();
wasCancelled = false;
charConverter = null;
charEncoding = null;
connection = null;
connectionId = 0L;
currentCatalog = null;
doEscapeProcessing = true;
eventSink = null;
fetchSize = 0;
isClosed = false;
lastInsertId = -1L;
maxFieldSize = MysqlIO.getMaxBuf();
maxRows = -1;
maxRowsChanged = false;
openResults = new ArrayList();
pedantic = false;
profileSQL = false;
results = null;
resultSetConcurrency = 0;
resultSetType = 0;
timeoutInMillis = 0;
updateCount = -1L;
useUsageAdvisor = false;
warningChain = null;
holdResultsOpenOverClose = false;
batchedGeneratedKeys = null;
retrieveGeneratedKeys = false;
continueBatchOnError = false;
if(c == null || c.isClosed())
throw SQLError.createSQLException(Messages.getString("Statement.0"), "08003");
connection = c;
connectionId = connection.getId();
currentCatalog = catalog;
pedantic = connection.getPedantic();
continueBatchOnError = connection.getContinueBatchOnError();
if(!connection.getDontTrackOpenResources())
connection.registerStatement(this);
if(connection != null)
{
maxFieldSize = connection.getMaxAllowedPacket();
int defaultFetchSize = connection.getDefaultFetchSize();
if(defaultFetchSize != 0)
setFetchSize(defaultFetchSize);
}
if(connection.getUseUnicode())
{
charEncoding = connection.getEncoding();
charConverter = connection.getCharsetConverter(charEncoding);
}
boolean profiling = connection.getProfileSql() || connection.getUseUsageAdvisor();
if(connection.getAutoGenerateTestcaseScript() || profiling)
statementId = statementCounter++;
if(profiling)
{
pointOfOrigin = new Throwable();
profileSQL = connection.getProfileSql();
useUsageAdvisor = connection.getUseUsageAdvisor();
eventSink = ProfileEventSink.getInstance(connection);
}
int maxRowsConn = connection.getMaxRows();
if(maxRowsConn != -1)
setMaxRows(maxRowsConn);
0 
}

There appears to be an extraneous 0 at the end.
[10 Apr 2008 4:31] A. Bakia
I got three reactions within an hour reminding me that the published MySQL source code does not have that 0 and that, if it did, the code would not have compiled anyway.

I hope the following will clarify things. I expect the constructor of the Statement class to already handle the case where the connection is null. Therefore, I was thinking more of a bug in the binary, Statement.class, in the JAR file in the Coldfusion lib package. After all, there are, to my knowledge, no reports of the error from other applications that use MySQL.
[10 Apr 2008 5:00] A. Bakia
A contribution. Rich.Thibault writes in the Coldfusion forum:

"... your post got me looking at their source code. The NPE happens at line 2178, which I believe is this line inside setMaxRows():

this.connection.unsetMaxRows(this);

So it looks like [Coldfusion] is invoking setMaxRows() after the connection has already gone dead (null). It should be detecting the dead connection, removing it from the pool, and starting a new one."
[10 Apr 2008 5:11] A. Bakia
I should have given the following response earlier. The extraneous 0 is most likely a decompiler error. Two other decompilers did not reproduce it.
[18 Jun 2008 5:19] Dennis Longnecker
I am getting this error to.  Refresh tends to always work.  Found similiar problem at:  
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?catid=3&threadid=1303546

java.lang.NullPointerException
	at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178)
	at coldfusion.server.j2ee.sql.JRunStatement.setMaxRows(JRunStatement.java:214)
	at coldfusion.sql.Executive.executeQuery(Executive.java:1276)
	at coldfusion.sql.Executive.executeQuery(Executive.java:1008)
	at coldfusion.sql.Executive.executeQuery(Executive.java:939)
	at coldfusion.sql.SqlImpl.execute(SqlImpl.java:325)
	at coldfusion.tagext.sql.QueryTag.executeQuery(QueryTag.java:831)
	at coldfusion.tagext.sql.QueryTag.doEndTag(QueryTag.java:521)

My coldfusion code is rather simple...

<cfset todaysdate = createodbcdate(now())>

<cfquery name="Get_Menu" Datasource="gyro4_Content">
		SELECT	*
		FROM	DynamicContent
		WHERE   (StartDate <= #CreateODBCDate(todaysdate)#) AND (EndDate >= #CreateODBCDate(todaysdate)#) AND (MenuBar = 'Y')
</cfquery>
[16 Sep 2009 13:58] Brian Pribnow
Has a solution to this bug been created?  I am receiving the same random error when we upgraded to CF8 from CF7.  Please help...

Server Product  ColdFusion  
Version  8,0,1,195765    
Edition  Standard    
Java Version  1.6.0_04    
Java Vendor  Sun Microsystems Inc.    
Java Vendor URL  http://java.sun.com/    
Java Home  C:\ColdFusion8\runtime\jre    
Driver  SeeFusion (MySQL5) - mysql-connector-java-commercial-5.0.5-bin.jar, seefusion.jar
[15 Apr 2011 10:48] Brian FitzGerald
I am having this same problem.  Any resolution in sight?

I am also on a Windows Server, MySQL 5, ColdFusion 8

Type: java.lang.NullPointerException

StackTrace:
java.lang.NullPointerException at com.mysql.jdbc.Statement.setMaxRows(Statement.java:2178) at coldfusion.sql.Executive.executeQuery(Executive.java:1267) at coldfusion.sql.Executive.executeQuery(Executive.java:1009) at coldfusion.sql.Executive.executeQuery(Executive.java:940) at coldfusion.sql.SqlImpl.
[15 Apr 2011 13:22] Tonci Grgin
Guys, in all these years I have not seen usable test case supporting your claims... Further more, it is *pool's* responsibility to check the connections before dealing stale ones out to application. Please configure your respective connection pools used to send validation query before reusing connection.

So far, I see no bug in our code here.
[15 May 2011 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2014 12:35] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.