You must configure either the server or JDBC driver (via the serverTimezone conf

逃离我推掉我的手 2022-01-30 00:49 315阅读 0赞

错误提示

  1. Fri May 17 14:55:39 CST 2019
  2. There was an unexpected error (type=Internal Server Error, status=500).
  3. nested exception is org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLSyntaxErrorException: Identifier name 'netsafe&useunicode=true&characterencoding=utf-8&allowmultiqueries=true&usessl=false' is too long ### The error may exist in com/infosec/netsafess/mapper/UserMapper.java (best guess) ### The error may involve com.infosec.netsafess.mapper.UserMapper.getAllUser ### The error occurred while executing a query ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLSyntaxErrorException: Identifier name 'netsafe&useunicode=true&characterencoding=utf-8&allowmultiqueries=true&usessl=false' is too long
  4. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:
  5. ### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLSyntaxErrorException: Identifier name 'netsafe&useunicode=true&characterencoding=utf-8&allowmultiqueries=true&usessl=false' is too long
  6. ### The error may exist in com/infosec/netsafess/mapper/UserMapper.java (best guess)
  7. ### The error may involve com.infosec.netsafess.mapper.UserMapper.getAllUser
  8. ### The error occurred while executing a query
  9. ### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLSyntaxErrorException: Identifier name 'netsafe&useunicode=true&characterencoding=utf-8&allowmultiqueries=true&usessl=false' is too long
  10. at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
  11. at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
  12. at com.sun.proxy.$Proxy60.selectList(Unknown Source)
  13. at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
  14. at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:147)
  15. at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:80)
  16. at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:58)
  17. at com.sun.proxy.$Proxy64.getAllUser(Unknown Source)
  18. at com.infosec.netsafess.service.impl.UserServiceImpl.getAllUser(UserServiceImpl.java:19)
  19. at com.infosec.netsafess.controller.HelloController.getAllUser(HelloController.java:25)
  20. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  21. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  22. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

解决办法

  1. //在url后加下面这个
  2. ?serverTimezone=UTC
  3. //完整版的
  4. spring.datasource.url=jdbc:mysql://localhost:3306/netsafe&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false

发表评论

表情:
评论列表 (有 0 条评论,315人围观)

还没有评论,来说两句吧...

相关阅读