当前位置:   article > 正文

数据库的错误:java.sql.SQLException: No suitable driver found for 123456_caused by: java.sql.sqlexception: no suitable driv

caused by: java.sql.sqlexception: no suitable driver
  1. at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:41)
  2. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:542)
  3. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:770)
  4. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:464)
  5. at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
  6. Caused by: java.sql.SQLException: No suitable driver found for 123456
  7. at java.sql.DriverManager.getConnection(Unknown Source)
  8. at java.sql.DriverManager.getConnection(Unknown Source)
  9. at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:224)
  10. at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.doGetConnection(UnpooledDataSource.java:219)
  11. at org.apache.ibatis.datasource.unpooled.UnpooledDataSource.getConnection(UnpooledDataSource.java:95)
  12. at org.apache.ibatis.datasource.pooled.PooledDataSource.popConnection(PooledDataSource.java:432)
  13. at org.apache.ibatis.datasource.pooled.PooledDataSource.getConnection(PooledDataSource.java:89)
  14. at org.apache.ibatis.transaction.jdbc.JdbcTransaction.openConnection(JdbcTransaction.java:139)
  15. at org.apache.ibatis.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:61)
  16. at org.apache.ibatis.executor.BaseExecutor.getConnection(BaseExecutor.java:337)
  17. at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:86)
  18. at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62)
  19. at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:325)
  20. at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
  21. at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109)
  22. at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:89)
  23. at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
  24. ... 29 more

我就想到配置数据库的配置文件出现问题回头查看果真如此:

错误的连接方式:

  1. spring:
  2. datasource:
  3. driver-class-name: com.mysql.cj.jdbc.Driver
  4. url: jdbc:mysql://localhost:3306/springboot?serverTimezone=Asia/Shanghai
  5. username: root
  6. url: 123456

发现有两个url,然后改成:

  1. spring:
  2. datasource:
  3. driver-class-name: com.mysql.cj.jdbc.Driver
  4. url: jdbc:mysql://localhost:3306/springboot?serverTimezone=Asia/Shanghai
  5. username: root
  6. password: 123456

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/593478
推荐阅读
相关标签
  

闽ICP备14008679号