I am using Java JDBC with MySQL and I get this error:
com.mysql.jdbc.MysqlDataTruncation: Data truncation:
Data too long for column 'column_name'
How do I remedy this error?
I am using Java JDBC with MySQL and I get this error:
com.mysql.jdbc.MysqlDataTruncation: Data truncation:
Data too long for column 'column_name'
How do I remedy this error?
How to reproduce this error in mysql terminal:
This is the error you are getting, however in the MySQL terminal shows it as a warning and still inserts your row, just silently truncates it.
The MySQL JDBC is not as forgiving, and spits a hard error and will not insert the row.
2 Solutions
Either Increase the capacity of the datatype you are inserting into, or decrease the size of the content you are placing in there.
Legend to increase the size of your column: