• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Data truncation issue

 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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);
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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic