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&characterEncoding=utf-8">
</property>
<property name="username" value="root"></property>
<property name="password" value="12345678"></property>
</bean>