June 20th, 2012, 06:52 PM
I am trying to insert a row in mysql database and I get this exception
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value adjusted for column.
The datatype of the column is bigint(20) unsigned.
And there are not more than 5 rows in the table.
What is the cause of this error?
June 20th, 2012, 07:38 PM
What value are you trying to insert into the column? The error means the data you passed for the column is not fully compatible with the column definition.
The number of rows in the table has nothing to do with the error.
June 25th, 2012, 11:55 AM
Its just numbers in the range of 1 to 20.
June 25th, 2012, 01:12 PM
in that case, BIGINT is overkill
Originally Posted by taas
BIGINT requires 8 bytes and holds numbers between -9,223,372,036,854,775,808 and 9,223,372,036,854,775,807
INTEGER requires 4 bytes and holds numbers between -2,147,483,648 and 2,147,483,647
MEDIUMINT requires 3 bytes and holds numbers between -8,388,608 and 8,388,607
SMALLINT requires 2 bytes and holds numbers between -32,768 and 32,767
TINYINT requires 1 byte and holds numbers between -128 and 127
which of these is appropriate for your data?