Bug #65943 ResultSet.getBytes() returns the non-padded data when padCharsWithSpace
Submitted: 18 Jul 2012 16:14 Modified: 18 Aug 2012 17:14
Reporter: Laurent Mazuel Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.1.15 OS:Linux (Debian Squeeze)
Assigned to: CPU Architecture:Any

[18 Jul 2012 16:14] Laurent Mazuel
Description:
The "padCharsWithSpace" works well using "getString(i)", but "getBytes(i)" does not return the padded string as bytes, but the original string as bytes.

How to repeat:
Create a table as (ANSI sql_mode format):

CREATE TABLE "Student" (
"ID" INTEGER,
"Name" CHAR(15) 
);
INSERT INTO "Student" ("ID","Name") VALUES (10,'Venus');

Then, make the query:
"Select Name from Student";

and
rs.getString(1).length() will return 15
rs.getBytes(1).length will return 5
[18 Jul 2012 17:14] Valeriy Kravchuk
Please, check if the same problem still happens with a newer version, 5.1.21.
[18 Jul 2012 21:05] Mark Matthews
I can almost guarantee this is still broken with the latest version of the driver. 

(wishing that we'd just have an ansi-mode space handling option in the server, rather than keep this out at the client).
[19 Aug 2012 1: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".