yuyanjun340
yuyanjun340
采纳率0%
2017-03-11 06:43

mybatis整合springmvc报数据库连接错误求解

oot cause

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))

The error may exist in cn/itcast/ssm/mapper/ItemsMapperCustom.xml

The error may involve cn.itcast.ssm.mapper.ItemsMapperCustom.findItemsList

The error occurred while executing a query

Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user 'root'@'localhost' (using password: YES))

org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)
org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • wu1226419614 Seeker-Wu 4年前

    怀疑你localhost的密码只支持自己连接,有可能不识别或者未授权,根据错误来看是不允许,所以你可以试着吧root@localhost:改为你数据库所在的ip地址,或者用其他用户来连接试一试;
    尽量不要用localhost来映射数据库连接,而用固定ip地址来代替。

    点赞 评论 复制链接分享
  • yuyanjun340 yuyanjun340 4年前

    工程代码放在在虚拟机win10下跑没有问题,在我本机上一直报这个错误,数据库服务器连接的都是一样的地址

    点赞 评论 复制链接分享

相关推荐