aspose file tools*
The moose likes JDBC and the fly likes Data truncation issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Data truncation issue" Watch "Data truncation issue" New topic
Author

Data truncation issue

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
For some reason when one of my textareas gets written to db, I get SQL Data
truncation error in the column populated by that textarea.
So I made a loop, like this:
String sz = (String)frmData.get("T11");
// @ 65 gives DATA TRUNCATION ERROR - WHY? ... so now set to 60
if (sz.length() > 60){
sz=sz.substring(0, 60);
frmData.put("T11",sz);
}
to cut down on user input, and as you see, when characters from the testarea go over 65, I get the error.
I tried setting that db column to LONGTEXT, MEDIUMTEXT, VARCHAR(200) when it really should be no more than 100 characters, - and I got same "SQL DATA truncation error" no matter what the length for the column is set to.
I have other textareas, identical to the one described above, that populate LONGTEXT columns - no problem.
Can anyone tell me what's happening?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data truncation issue