org.hibernate.exception.GenericJDBCException: Could not open connection
2014-03-01 23:14
645 查看
使用spring配置文件连接数据库时出现:Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory
(Access denied for user 'wang'@'localhost' (using password: YES)) //wang是我的电脑用户名
出错的配置文件如下:
applicationContext.xml文件中:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${driverclass}"></property>
<property name="url" value="${url}"></property>
<property name="username" value="${username}"></property>
<property name="password" value="${password}"></property>
</bean>
jdbc.properties文件中:
driverclass=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/oa
username=root
password=tiger
applicationContext配置参数中username使用${username}貌似得到的是系统用户名,而不是properties文件中的值
在properties文件中不要使用username = ***,可以使用user
改为user后错误就没有了
(Access denied for user 'wang'@'localhost' (using password: YES)) //wang是我的电脑用户名
出错的配置文件如下:
applicationContext.xml文件中:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${driverclass}"></property>
<property name="url" value="${url}"></property>
<property name="username" value="${username}"></property>
<property name="password" value="${password}"></property>
</bean>
jdbc.properties文件中:
driverclass=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/oa
username=root
password=tiger
applicationContext配置参数中username使用${username}貌似得到的是系统用户名,而不是properties文件中的值
在properties文件中不要使用username = ***,可以使用user
改为user后错误就没有了
相关文章推荐
- org.hibernate.exception.GenericJDBCException: Could not open connection
- org.hibernate.exception.GenericJDBCException: Could not open connection
- cloudera-scm-server启动时出现Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: Could not open connection问题解决方法(图文详解)
- org.hibernate.exception.GenericJDBCException: Could not open connection
- org.hibernate.exception.GenericJDBCException: Could not open connection
- org.hibernate.exception.GenericJDBCException: Could not open connection解决思路 SSH框架
- Cloudera-scm-server启动报org.hi bernate.exception.GenericJDBCException: Could not open connection
- 用数据库连接池解决org.hibernate.exception.JDBCConnectionException:could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- 名未错误---org.hibernate.exception.GenericJDBCException: could not execute statement
- Hibernate之org.hibernate.exception.GenericJDBCException:could not execute statement
- nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.JDBCConnectionException: could not execute query
- org.hibernate.exception.GenericJDBCException: Cannot open connection
- org.hibernate.exception.JDBCConnectionException: could not execute query
- code is 9998;desc is 插入失败exception is org.hibernate.exception.JDBCConnectionException: Could not op
- org.hibernate.exception.GenericJDBCException: Cannot open connection
- org.hibernate.exception.GenericJDBCException: could not load an entity: