jdbc.properties文件中的配置需要加上" jdbc."的前缀
在配置数据库连接信息(jdbc.properties文件)时跟着老师的编码走的,如下:
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8
username=root
password=464648
但是居然报错了:
### 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 mapper/CustomerMapper.xml
### The error may involve com.zhexiang.mybatis_springmvc.model.selectCustomerByID
### The error occurred while executing a query
后来百度了一下,在以上的配置中需要写成如下形式,有哪位同学知道具体原因么?
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/seckill?useUnicode=true&characterEncoding=utf8
jdbc.username=root
jdbc.password=