Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Victor Ade
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.
 
Xayyam Sadigov
Greenhorn
Posts: 3
C++ Java Python
  • 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:
 
Knute Snortum
Sheriff
Posts: 3734
90
Chrome Eclipse IDE Java Postgres Database VI Editor
  • 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: 3734
90
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So switching setString 3 and setInt 4 fixed it?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!