org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection

org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection异常问题解决;

spring boot ,mybatis ,sqlserver 2000,STS3.9 、jdk8 ,sqljdbc4 1.0-2000的一个环境启动时,调用查询Dao时报错。

具体错误如下:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException: 
### Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jdbc:microsoft:sqlserver://10.249.0.129:1433;DatabaseName=YZYB'
### The error may exist in file [D:\STS-CODE\yzyb\target\classes\mapper\SupplierMapper.xml]
### The error may involve com.cn.lbx.dao.SupplierDao.getSuppliers
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jdbc:microsoft:sqlserver://10.249.0.129:1433;DatabaseName=YZYB'
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77) ~[mybatis-spring-1.3.1.jar:1.3.1]
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) ~[mybatis-spring-1.3.1.jar:1.3.1]
   

数据源配制:

经过查询百度上是如下说法:

连接SqlServer2000 
 
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); 
URL = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tempdb"; 
 
连接SqlServer2005 
 
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); 
URL = "jdbc:sqlserver://localhost:1433;DatabaseName=tempdb"; 

而我自己的正好是sqlserver2000,经过上一篇文章中处理的问题,干脆所有配制都改成sqlserver2005版本形式。

修改后如下图:

修改后系统就能正常进行增、删、查、改了!!!。怀疑是跟我用的驱动与系统环境比较新有关吧!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值