Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to solve: java.sql.SQLException: Data truncated for column 'clicked' at row 1

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to insert an integer number into the database with this statement;



but i keep getting this error and i dont seem to understand what i'm doing wrong.



I understand data truncation issue occur for example when you're trying to insert a string into a char datatype but i'm not doing this.
 
Greenhorn
Posts: 3
Python C++ Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please share a table structure.
Most probably there is a data type issue or you putting a data that is too long for the column.

And also please try to simplify your code and test:
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Victor: Please avoid using ALL CAPS in a post or subject line.  I fixed it for you this time.
 
Victor Ade
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Xayyam Sadigov. actually the problem stems from the sequence in which i was inserting my data.
here's my create code:


and i was inserting data like so:

 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So switching setString 3 and setInt 4 fixed it?
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic