日食 +休眠+ Windows XP 赢 7

发布于 2025-01-07 17:27:37 字数 2214 浏览 4 评论 0原文

我在 windows xp 上安装了 eclipse,一切正常。我的项目是GWT和gilead hibernate,数据库是oracle。

当我决定在家工作时,我只是将整个 Eclipse 复制到我的闪存中,并将工作区复制到我的 Windows 7 中。

之后我决定从 oracle Db 移动到 mysql Db,所以我更改了整个 hibernate.cfg.xml 文件为了为 mysql 做好准备,我删除了 ojdbc 库并添加了 mysql 连接器。

毕竟,当我尝试运行该项目时,会显示以下错误:

无法连接到数据库,

就像 Eclipse 正在从旧的 hibernate.cfg.xml 文件中读取一样。

那么有人知道发生了什么事吗???

这是我用于 Oracle 连接的 hibernate.cfg.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property   name="hibernate.connection.url">jdbc:oracle:thin:@IP:1521:DEVDB10GR2</property>
<property name="hibernate.connection.username">something</property>
<property name="hibernate.connection.password">something</property>
<property name="hibernate.show_sql">true</property>
<property name="format_sql">true</property>
<mapping class="net.school.shared.hibernate.GsWorkingshift"/>
</session-factory>
</hibernate-configuration>

这是我用于 mySql 连接的 hibernate.cfg.xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost  /hibernatetutorial</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.show_sql">true</property>
<property name="format_sql">true</property>
<mapping class="net.school.shared.hibernate.GsWorkingshift"/>
</session-factory>
</hibernate-configuration>

在我执行此操作后,此错误继续传播:

无法连接到 Oracle,

但是当我在工作 PC 上尝试时效果很好。

I have an eclipse installed at windows xp and everything works fine. My project is GWT with gilead hibernate and the database is oracle.

When i decided to work from home, i just copied the entire eclipse to my flash memory with my workspace to my windows 7.

After that i decided to move from oracle Db to mysql Db, so i change the entire hibernate.cfg.xml file to make ready for mysql, i deleted the ojdbc library and added the mysql connector.

After all of that when i try to run the project the error below is shown:

Could not connect to the database

it's like the eclipse is reading from the old hibernate.cfg.xml file.

So does anybody know what is happening ???

This is my hibernate.cfg.xml file for oracle connetion:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property   name="hibernate.connection.url">jdbc:oracle:thin:@IP:1521:DEVDB10GR2</property>
<property name="hibernate.connection.username">something</property>
<property name="hibernate.connection.password">something</property>
<property name="hibernate.show_sql">true</property>
<property name="format_sql">true</property>
<mapping class="net.school.shared.hibernate.GsWorkingshift"/>
</session-factory>
</hibernate-configuration>

This is my hibernate.cfg.xml file for mySql connetion:

<?xml version="1.0" encoding="utf-8"?>
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost  /hibernatetutorial</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hibernate.show_sql">true</property>
<property name="format_sql">true</property>
<mapping class="net.school.shared.hibernate.GsWorkingshift"/>
</session-factory>
</hibernate-configuration>

after i do this this error is keep sowing:

Could not connect to oracle

but when i try it on my work PC it works fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

画▽骨i 2025-01-14 17:27:37

首先检查您的数据库服务器是否处于活动状态。连接任何数据库浏览器软件以访问您的数据库表。然后清理构建您的代码并尝试重新启动您的网络服务器。问题可能出在数据库服务器或其凭据上。

First check your Database sever is live. Connect with any database explorer software to access your database tables. Then clean build your code and try restarting your web server. Problem could be with database server or its credentials.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文