解决Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException

今天写项目时遇到这个问题: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: NO))
发现是没修改密码,所以连接不上MySQL数据库。如图所示:
解决Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException_第1张图片
找到db.properties文件,将密码改为自己的MySQL数据库连接密码。
datasource.connection.driver_class=com.mysql.jdbc.Driver
datasource.connection.url=jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf-8
datasource.connection.username=root
datasource.connection.password=123456
我设的密码为:123456
修改后数据库连接成功!
解决Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException_第2张图片

你可能感兴趣的:(java,mysql,数据库,eclipse,jdbc)