【发布时间】:2011-03-21 18:32:46
【问题描述】:
我遇到了休眠问题,不知道到底发生了什么,我有这个项目在工作,我使用以下设置连接到 Oracle 10g 数据库:
Host Name: localhost
port:1521
SID:orcl
user:anfxi
password:password
现在我在家尝试远程使用同一个数据库,我通过 VPN 连接并且数据库 IP 现在是 10.73.98.230,我导入了我的 WAR 并更改了我的设置
hibernate.cfg.xml 来自:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://localhost:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
到:
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin://10.73.98.230:1521:orcl</property>
<property name="hibernate.connection.username">anfexi</property>
<property name="connection.password">password</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="show_sql">true</property>
<property name="hbm2ddl.auto">validate</property>
<property name="current_session_context_class">thread</property>
但我不断收到此错误:
ERROR [main] (SchemaValidator.java:135) - could not get database metadata
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl
所以它似乎仍在使用 localhost 作为数据库地址,我清理了我的项目并重建了,仍然没有运气,还有什么我可能会丢失的吗?休眠配置是否被缓存在我必须擦除的某些文件中?
编辑
对于它可能提供的服务,我可以使用 SQL 开发人员进行连接,问题只是休眠仍然使用旧的localhost:1521:orcl 连接描述符。
感谢您的帮助!
【问题讨论】:
标签: eclipse hibernate jakarta-ee oracle10g vpn