While establishing the connection to a MySQL database, I\'m getting the following error
java.sql.SQLException: Unknown initial character set index \'255\' receiv
You can add ?characterEncoding=latin1"
after your url String like this
for e.g.:
"jdbc:mysql://localhost/yourDB?characterEncoding=latin1";
It might work.
The way I fixed it : Add characterEncoding=utf8 to the end of jdbc connection string
E.g. connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/photo_app?" + "user=root&password=root&characterEncoding=utf8");
Use Version 5.1.44 of mysql-connector-java.
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.44</version>
</dependency>
Adding the following to your connection string should work:
jdbc:mysql://localhost/yourDB?characterEncoding=latin1;
Just download latest version of hibernate jar file from
https://www.javatpoint.com/src/hb/hibernatejar.zip
and the MySQL connector jar file from
https://dev.mysql.com/downloads/connector/j/5.1.html
Compatible version of mysql-connector-java should be required as per installed MySQL Server ---> For my installed MySQL Server 8.0 I download mysql-connector-java-8.0.20 in SoapUi/bin/ext folder or build path of project in eclipse. it works for me!!