java.sql.SQLException: Unknown initial character set index '255' received from server for connector 8.0.11

后端 未结 14 1674
再見小時候
再見小時候 2021-02-14 22:13

While establishing the connection to a MySQL database, I\'m getting the following error

java.sql.SQLException: Unknown initial character set index \'255\' receiv         


        
相关标签:
14条回答
  • 2021-02-14 22:46

    You can add ?characterEncoding=latin1" after your url String like this for e.g.:

    "jdbc:mysql://localhost/yourDB?characterEncoding=latin1";
    

    It might work.

    0 讨论(0)
  • 2021-02-14 22:46

    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");

    0 讨论(0)
  • 2021-02-14 22:47

    Use Version 5.1.44 of mysql-connector-java.

    <dependency>
       <groupId>mysql</groupId>
       <artifactId>mysql-connector-java</artifactId>
       <version>5.1.44</version>
    </dependency>
    
    0 讨论(0)
  • 2021-02-14 22:48

    Adding the following to your connection string should work:

    jdbc:mysql://localhost/yourDB?characterEncoding=latin1;
    
    0 讨论(0)
  • 2021-02-14 22:52

    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

    0 讨论(0)
  • 2021-02-14 22:56

    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!!

    0 讨论(0)
提交回复
热议问题