在application.properties中我有这个配置:
spring.datasource.url=jdbc:mysql://adressToDB/NameOfDB
spring.jpa.properties.connection.CharSet=utf8
spring.jpa.properties.connection.characterEncoding=utf8
spring.jpa.properties.hibernate.connection.useUnicode=true
我尝试将直接的西里尔符号插入到DB中,但插入语句失败并出现此错误:
INSERT INTO `matica`.`user` (`email`, `name`, `user_id`) VALUES ('стева', 'стева', '57');
Operation failed: There was an error while applying the SQL script to the database.
ERROR 1366: 1366: Incorrect string value: '\xD1\x81\xD1\x82\xD0\xB5...' for column 'email' at row 1
SQL Statement:
INSERT INTO `matica`.`user` (`email`, `name`, `user_id`) VALUES ('стева', 'стева', '57')