Bug #17442 preparedStatment and getString
Submitted: 16 Feb 2006 8:22 Modified: 31 Mar 2014 10:58
Reporter: chen bill Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:all latest source code OS:Any (ignore)
Assigned to: Alexander Soklakov CPU Architecture:Any

[16 Feb 2006 8:22] chen bill
Description:
I use preparedStatement to send sql command , than use getString() to get string.
But the string which has been  retrived seems to incorrect.
After my debugging process, I find jdbc driver calls 
"private com.mysql.jdbc.ResultSet serverExecute(int maxRowsToRetrieve,boolean createStreamingResultSet)" method 
in which it also calls 
"com.mysql.jdbc.ResultSet rs = mysql.readAllResults(this,
maxRowsToRetrieve, this.resultSetType,
this.resultSetConcurrency, createStreamingResultSet,
this.currentCatalog, resultPacket, true, this.fieldCount,
true);".
you can find the last third paramater is "true" which  represent "isBinaryEncoded".
So we can conclude that if we use preparedStatement the indicater "isBinaryEncoded" will always be true. This will result in incorrection when you call getString() method afterward.Because getString() method is call native getter method actually which treat "thisrow" data as Object rather than String.

I don't really understand the useage of "isBinaryEncoded". according to MYSQL's explanation is as follows:
	/**
	 * Is the data stored as strings (default) or natively (which is the case
	 * with results from PrepStmts)
	 */
	protected boolean isBinaryEncoded = false;
So maybe this is a bug maybe no , but why i use the old jdbc driver is right. I'm rather confused .

How to repeat:
it always repeats .
[16 Feb 2006 17:23] Mark Matthews
Incorrect how? What do you expect, and what is actually returned?
[17 Feb 2006 2:01] chen bill
the return is address like "[B@1a6518" rather than values in it.
[24 Feb 2006 22:32] Mark Matthews
What's the table that you're using use for a type for the column in question? 

What query do you use to retrieve the string?
[25 Mar 2006 0: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 10:58] 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.