一、使用Druid创建数据库链接时报错 2023-02-15 15:53:49.353 [planflight] [Druid-ConnectionPool-Create-1819862363] ERROR [DruidDataSourc
2023-02-15 15:53:49.353 [planflight] [Druid-ConnectionPool-Create-1819862363] ERROR [DruidDataSource.java:2471] - create connection sqlException, url: jdbc:Mysql:127.0.0.1:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true, errorCode 0, state nulljava.sql.SQLException: connect error, url jdbc:mysql:127.0.0.1:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true, driverClass com.mysql.cj.jdbc.Driver at com.alibaba.druid.pool.DruidAbstractDataSource.createPhysicalConnection(DruidAbstractDataSource.java:1627) at com.alibaba.druid.pool.DruidDataSource$CreateConnectionThread.run(DruidDataSource.java:2468)
根本原因为jdbc-url错误,标准格式为
jdbc:mysql://[host][:port]/[database]
例如本例应修改为
jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
注意斜线等内容
来源地址:https://blog.csdn.net/qq_23915881/article/details/129046029
--结束END--
本文标题: 使用Druid创建MySQL链接时在DruidAbstractDataSource.createPhysicalConnection产生SQLException异常
本文链接: https://lsjlt.com/news/403113.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0