I have my application.propertiesconfigured as follows:
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.url = jdbc:mysql://localhost:3306/dbname?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
And in mine pom.xml, I have a property configured as follows:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<start-class>toyanathapi.Application</start-class>
<java.version>1.8</java.version>
</properties>
My Entity: @ Entity OpenResifalEntity Class {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String date;
private int rollno;
private String name;
}
Problem 1: If I use the above setting, I get an exception
java.sql.SQLException: Incorrect string value: '\xE0\xA4\xA7\xE0\xA4\xBE...
Problem 2: If I change the data source URL to this:
spring.datasource.url = jdbc:mysql://localhost:3306/dbname
Unicode in my database is saved as
29 | 2074-03-04 | 3 | ?????????????? ?????,?????? ??????, ??????????? ????? ? ???? ???? ???? ??????

How can I save them in mysql as if they are in unicode instead , getting all the unicode data converted to ????????.