com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column ‘column_name’

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.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)