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 faced same issue in my spring boot data jpa application when i going to insert image file in data base as byte its given me same error.
After many R & D i found solution like below.
I added below line in my application.properties file and resolve that
spring.datasource.url=jdbc:mysql://localhost:3306/conweb?sessionVariables=sql_mode='NO_ENGINE_SUBSTITUTION'&jdbcCompliantTruncation=false
Hope it will helpful to someone.