Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Data truncation issue  RSS feed

liliya woland
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!