当我尝试连接到测试数据库时,按照所示的设置,我面临着所提到的所有错误。
大多数配置都来自工作生产环境,但我无法连接到我的测试数据库。
我尝试过各种各样的方法,但它无法正常运行。
我能够通过其他方法连接测试数据库,例如PLSQL开发人员或SQLPLUS。
我遇到的错误是:
org.hibernate.exception.GenericJDBCException: Cannot open connection
....
....
....
Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
....
....
....
Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1422)
at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:606)
at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:526)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:756) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:683)
这是我的hibernate配置文件:
<session-factory>
<property name="hibernate.connection.url">jdbc:oracle:thin:@ipaddress:1521:dbname</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.username">user</property>
<property name="hibernate.connection.password">password</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
<property name="connection.is-connection-validation-required">true</property>
<property name="hibernate.connection.provider_class">org.hibernate.connection.C3P0ConnectionProvider</property>
<property name="hibernate.c3p0.max_size">1</property>
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.timeout">50000</property>
<property name="hibernate.c3p0.max_statements">100</property>
<property name="hibernate.c3p0.idle_test_period">3000</property>
<property name="hibernate.c3p0.acquire_increment">1</property>
<property name="hibernate.c3p0.validate">false</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<mapping resource etc>
</session-factory>
任何人都可以帮我解决这个问题吗?
答案 0 :(得分:3)
它出现的原因有很多,比如
您输入的数据库配置详细信息不正确或已更改,例如Confluence数据库的数据库名称或数据库用户名/密码。
1)数据库的URL不正确。
2)数据库服务器未运行。如果数据库服务器已关闭,请重新启动它并检查日志以查看其失败或停止的原因。
3)网络中断(或者在汇合和数据库服务器之间存在干扰),并且无法建立与数据库的连接。
4)您的数据库密码已过期。
5)检查你的司机,你的班级路径是否存在。