Issue Details (XML | Word | Printable)

Key: JDBC-354
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Chouteau Mathieu
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

With UTF8, exceed size limit do not throw same Exception

Created: 16/May/14 07:59 AM   Updated: 16/May/14 03:18 PM
Component/s: JDBC driver
Affects Version/s: Jaybird 2.2.4
Fix Version/s: None

File Attachments: 1. Java Source File TestEncodingFB.java (4 kB)

Environment: Windows, UTF8


 Description  « Hide
Use a preparedStatement with a parameter on a 5 characters column.

When you execute the query (select, update, delete or insert), you don't obtain the same result if the length of the parameter value is over 5 or over 20 :
 - Over 5 characters you obtain a FBSQLException
 - Over 20 characters you obtain a DataTruncation

If the value contain 11 accented characters, the DataTruncation Exception is thrown.

I have attached a JUnit test case.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Chouteau Mathieu added a comment - 16/May/14 08:00 AM
JUnit test case

Chouteau Mathieu added a comment - 16/May/14 08:03 AM
To create the table wich is used by the JUnit test case :

CREATE TABLE TEST
(
  ID integer NOT NULL,
  CODE varchar(5),
  CONSTRAINT CONSTRAINT_NAME PRIMARY KEY (ID)
);

Mark Rotteveel added a comment - 16/May/14 03:18 PM
The observed behavior is caused by a check that doesn't take the bytes per character into account. It will only throw the DataTruncation exception when the value exceeds the storage length (nr chars * nr of bytes per char) instead of the nr of chars. I am not sure if I am going to fix this in 2.2 as this will probably be significantly rewritten in Jaybird 3.0.