0

I have a table called tbStudent. When I set the sex field using integers, and pass the parameter value in as 1 or 0 , it works just fine. But now,when I try to update the sex field type using bits, and also pass the parameter value in as 1 or 0 , it does not work correctly. I try to pass the parameter value in as true or false ,but it still does not work as intended. How to fix it so that it will work with bits? The error is:

//I only pass in the value 1, why does it say too long?
Data truncation: Data too long for column 'SEX' at row 1;
nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: 
Data too long for column 'SEX' at row 1
flower
  • 2,212
  • 3
  • 29
  • 44

1 Answers1

2

try inserting as b'1' or b'0' source: http://dev.mysql.com/doc/refman/5.0/en/bit-field-literals.html

user2044822
  • 135
  • 6