Spring mybatis Access denied for user 'root'@'localhost' (using password:YES)
2016-05-26 22:38
471 查看
spring 3.X 提供了 <context:property-placeholderlocation="classpath:prop/jdbc.properties"
/>
方便加载数据库配置。
今天我用spring4.X 和 dbcp2 集成 用 <context:property-placeholderlocation="classpath:prop/jdbc.properties"
/> 加载配置文件。
值都能取到 但是连接数据库时总是报 Access denied for user 'root'@'localhost' (using password:YES) 本以为是数据库密码的问题,重新改了数据库密码,还是报同样的错误。 。最后我改 <context:property-placeholderlocation="classpath:prop/jdbc.properties"
/> 为
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/classes/dbconfig.properties</value>
</list>
</property>
</bean>
这个就没问题了 。
另外
亲测: spring 3.x +dbcp 用 <context:property-placeholderlocation="classpath:prop/jdbc.properties" />
配置没有任何问题。
/>
方便加载数据库配置。
今天我用spring4.X 和 dbcp2 集成 用 <context:property-placeholderlocation="classpath:prop/jdbc.properties"
/> 加载配置文件。
值都能取到 但是连接数据库时总是报 Access denied for user 'root'@'localhost' (using password:YES) 本以为是数据库密码的问题,重新改了数据库密码,还是报同样的错误。 。最后我改 <context:property-placeholderlocation="classpath:prop/jdbc.properties"
/> 为
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>/WEB-INF/classes/dbconfig.properties</value>
</list>
</property>
</bean>
这个就没问题了 。
另外
亲测: spring 3.x +dbcp 用 <context:property-placeholderlocation="classpath:prop/jdbc.properties" />
配置没有任何问题。
相关文章推荐
- java对世界各个时区(TimeZone)的通用转换处理方法(转载)
- java-注解annotation
- java-模拟tomcat服务器
- java-用HttpURLConnection发送Http请求.
- java-WEB中的监听器Lisener
- Android IPC进程间通讯机制
- Android Native 绘图方法
- Android java 与 javascript互访(相互调用)的方法例子
- 介绍一款信息管理系统的开源框架---jeecg
- 聚类算法之kmeans算法java版本
- java实现 PageRank算法
- PropertyChangeListener简单理解
- c++11 + SDL2 + ffmpeg +OpenAL + java = Android播放器
- 插入排序
- 冒泡排序
- 堆排序
- 快速排序
- 二叉查找树