• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Batch inserts exception getting thrown..

 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I keep getting the following error when trying to load data into a table from a file.

ERROR - com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'contentId' at row 64
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data truncated for column 'contentId' at row 64


contentId in the tab delimted text file is always null (in the table it is an auto incremented field and this exception is thrown regardless on every file I try to load (although I haven't tried to load a file with less than 64 rows yet). I can't see anything different about row 64 than any other row (and it doesn't regardless of the data set on row 64). And the table seems to load just fine, but then it kicks out an exception screwing up the next steps. I suppose I could catch it and do nothing, though I loathe to do this with out knowing why.


-Tad
 
author
Posts: 4278
34
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Going out on a limb, but what was is the data type and size of content id in the database? You could be auto-incrementing past its size if it is small too small.

The error seems like its a data field problem but post mentions that the field is null and irregardless of the data the error comes up. I'd suggest posting your table defintion as well as a few example rows and see if that sheds any light.
 
Tad Dicks
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The field is a Bigint (mysql data type). And the input for the field is null b/c its an autoincrementing field. The fields in the input file are tab delimited and I've tried putting '' in and nothing for the id field. The strange thing is it seems to work fine. I guess whats the harm in truncating null data? but its still annoying.

-Tad
 
This tiny ad will self destruct in five seconds.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic