com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'column_name'
java, mysql, truncation
Solution
I faced the same issue in my Spring Boot Data JPA application when I was going to insert an image file in the database as bytes - it gave me the same error.
After many R&D I found a solution like below.
I added the following line in my `application.properties` file and it resolved the issue:
spring.datasource.url=jdbc:mysql://localhost:3306/conweb?sessionVariables=sql_mode='NO_ENGINE_SUBSTITUTION'&jdbcCompliantTruncation=false
Hope it will be helpful to someone.
Problem
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?