java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案

解决方案:

  1. 首先查看数据库的版本号,删除旧的jar包,将mysql-connector-java.jar更换成对应版本号
  2. 同时在连接数据库的url后加上?useUnicode=true&characterEncoding=utf-8

java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案

原文地址:https://www.cnblogs.com/NFii/p/12048524.html

时间: 2024-11-08 16:00:24

java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.解决方案的相关文章

Hibernate卡住,然后报错java.sql.SQLException: Unknown system variable 'language'异常

启动应用的时候会卡在: 08:22:58,221 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator]. 08:22:58,226 DEBUG IntegratorServiceImpl:46 - Adding Integrator [org.hibernate.secure.spi.JaccIntegrator]. 08:22:

java.sql.SQLException: Unknown type '246 in column 0 of 1 in binary-encoded result set的解决办法

最近在大学毕设项目基础上新增一些功能,基于Struts2开源框架,数据库采用的是MySQL.写完后台的新功能代码,单元测试也顺利通过,去整合前台,但是当使用JSP页面操作的时候,没想到报异常了.截图如下: java.sql.SQLException: Unknown type '246 in column 2 of 4 in binary-encoded result set. 纳闷了,为什么能够通过JUnit呢? 几经查找,都说是MySQL的bug,更换了MySQL新版本的驱动包,比如mysq

java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list' 报错问题

报错信息: java.sql.SQLException: Unknown column 'user0_.user_name' in 'field list'Query is: select user0_.id as id1_0_, user0_.user_name as user_nam2_0_, user0_.password as password3_0_ from user user0_java thread: http-nio-8881-exec-1 Hibernate报错:说表里没有u

JDBC报错 消息 Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'

今天用JDBCTemplate时,发现启动服务器之后报错: Could not get JDBC Connection; nested exception is java.sql.SQLException: Unknown system variable 'tx_isolation'. 网上说是因为MySQL版本过高的问题,我的MySQL版本是8.0,里面已经没有tx_isolation,变成了transaction_isolation,用了以下几种解决方法: (1)更改MySQL  无效,仍然

java.sql.SQLException: Unknown system variable 'query_cache_size'

Jar包版本不对: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.40</version> </dependency> 换个版本就好了: <dependency> <groupId>mysql</groupId> <arti

解决问题:java.sql.SQLException: Unknown system variable &#39;tx_isolation&#39;

是因为MySQL版本高但驱动jar包的版本太低, 因此将mysql-connector-java升级到最新版本就解决了问题: <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>8.0.17</version></dependency> 但紧接着又发现报错: 在数据库连接配置文件

Caused by: java.sql.SQLException: Parameter index out of range (1 &gt; number of parameters, which is 0

1.错误描述 org.hibernate.exception.GenericJDBCException: error executing work at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql

java.sql.SQLException: Parameter index out of range (0 &lt; 1 )

由于初学写JDBC,所以烦了一个白痴错误,特此记录下来,以期望对寻求同样错误的小伙伴们一个答案,也是自己学习的一个总结记录 该异常的提示错误代码处并不是实际出现错误的代码处. 异常提示为:java.lang.RuntimeException: java.sql.SQLException: Parameter index out of range (0 < 1 ). 原文错误代码为: stmt = conn.prepareStatement("insert into users(name,p

mysql插入报错:java.sql.SQLException: Incorrect string value: &#39;\xE6\x9D\xAD\xE5\xB7\x9E...&#39; for column &#39;address&#39; at row 1

界面报错: 日志报错: java.sql.SQLException: Incorrect string value: '\xE6\x9D\xAD\xE5\xB7\x9E...' for column 'address' at row 1 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.17.jar:8.0.17] at com.mys