Exception in thread "main" org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
### The error may exist in com/itheima/dao/AccountDao.java (best guess)
### The error may involve com.itheima.dao.AccountDao.findById
### The error occurred while executing a query
### Cause: java.sql.SQLException: Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:149)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:140)
at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:76)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:87)
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:152)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85)
at com.sun.proxy.$Proxy9.findById(Unknown Source)
at App_mybatis.main(App_mybatis.java:28)

解决://jdbc.url = "jdbc:mysql://localhost:3306/spring_db" 如果使用这句就会报错。
//Unknown initial character set index '255' received from server. Initial client character set can be forced via the 'characterEncoding' property.
jdbc.url = "jdbc:mysql://localhost:3306/spring_db?&characterEncoding=utf8";//改成这句,就可以了

1万+





