Unknown initial character set index ‘255‘ received from server.

spring 项目中连接数据库报错:

Unknown initial character set index ‘255’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property.

解决方法:
应该JDBC连接库的URL加上(复制代码里面的)
?useUnicode=true& amp;characterEncoding=utf-8

<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="com.mysql.jdbc.Driver">
		</property>
		<property name="url" value="jdbc:mysql://localhost:3306/tree?useUnicode=true&amp;characterEncoding=utf-8">
		</property>
		<property name="username" value="root"></property>
		<property name="password" value="12345678"></property>
	</bean>

参考:https://blog.csdn.net/si_si_si/article/details/104457315?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.control

猜你喜欢

转载自blog.csdn.net/weixin_40408952/article/details/111227158
今日推荐