Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not b

报错信息:

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
### The error may exist in com/shiyaxin/dao/IAccountDao.java (best guess)
### The error may involve com.shiyaxin.dao.IAccountDao.findAll

原因:org.springframework.jdbc。获取JDBC连接失败;嵌套异常是java.sql。无法从基础数据库获取连接!
###错误可能存在于com/shiyaxin/dao/IAccountDao.java(最佳猜测)
错误可能涉及com.shiyaxin.dao.IAccountDao.findAll

分析到错误的代码处:
注意url和driver里面的/和:,不要多了,或者少了,我的错误是多了一个/

 <!--Spring整合MyBatis对象-->
    <!-- 配置连接池 c3p0的写法,跟POOLED属性名不一样的-->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="com.mysql.jdbc.Driver"></property>
        <property name="jdbcUrl" value="jdbc:mysql://localhost:3306/ssm"></property>
        <property name="user" value="root"></property>
        <property name="password" value="123456"></property>
    </bean>
    <!-- 配置SqlSessionFactory工厂-->
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <property name="dataSource" ref="dataSource"></property>
    </bean>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
引用和提到了解决"Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: interrupt"错误的方法。根据引用中的建议,可以尝试在database.properties文件中的jdbc.url属性中删除"useSSL=true"或将其改为"useSSL=false"。这种方法可能解决该错误。另外,引用还提到了在jdbc.url中添加"useJDBCCompliantTimezoneShift=true&serverTimezone=UTC"的方法来解决类似的问题。根据这些引用的建议,你可以尝试修改数据库配置文件中的相关设置来解决这个问题。123 #### 引用[.reference_title] - *1* [Failed to obtain JDBC Connectionnested exception is java.sql.SQLException: interrupt (xxl-job)](https://blog.csdn.net/hawinlolo/article/details/112951099)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *2* [Failed to obtain JDBC Connection... nested exception is java.sql.SQLException: Connections could not b](https://blog.csdn.net/qq_50754735/article/details/118965074)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] - *3* [报错: Failed to obtain JDBC ... nested exception is java.sql.SQLException: The server time....](https://blog.csdn.net/weixin_45678130/article/details/113941434)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}} ] [.reference_item] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值