我jdbc.properties里的usename写的是root为啥debug queryById的时候报错Access denied for user 'JAY'@'localhost' (using password: YES)。。。我是小白。。
这是因为你数据库没连接上,用户名或者密码错了。小白的话去网上看看如何配置mysql的
发自网易邮箱大师 在2017年04月15日 22:24,tmlvampire 写道:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
数据库我确定是对的 因为不用配置文件的话就连上了。。。。。。用了jdbc,properties就报这个错。。好奇怪
既然能连上那应该不是数据库没打开的缘故,估计是你的spring配置文件中没有将jdbc.properties正确的配置上,再检查下你的resources包下的spring-dao文件试试
spring-dao.xml中
啊哈这种错误我不清楚,不过好像又长了新姿势哈!那使用${username}不能成功连接数据库的建议将参数username换成user试试,谢谢这位小兄弟!
亲测有效,spring-dao.xml和jdbc.properties的中username改成user有用,谢谢各位帮忙解决的层主
不能用username做key
mac中应该好的
就是${username}被系统变量覆盖了,不要用username做key即可
你们怎么运行的啊,数据库都没有啊
楼上说的都对的,用户名被覆盖了,一般我写jdbc.properties的时候都会加上jdbc. 的前缀,个人认为比较规范。 jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost:3306/seckill?useUnicode=true&characterEncoding=utf-8 jdbc.username=root jdbc.password=root