在 Netbeans 中使用 Hibernate 配置文件连接到 Apache Derby 时出现问题(错误 XSDB6)

发布于 2024-08-28 02:24:41 字数 1725 浏览 8 评论 0原文

我已经在 Netbeans 中创建了本地 Apache Derby 数据库,但是当我尝试使用“Hibernate 逆向工程向导”自动生成 POJO 文件时遇到问题。

我的 Hibernate 配置(由 Netbeans 从数据库连接生成,然后我添加了一些位):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
 <!-- Default Netbeans generated parameters -->
    <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
    <property name="hibernate.connection.url">jdbc:derby:C:/CerealDatabase</property>
    <property name="hibernate.connection.username">cerealuser</property>
    <property name="hibernate.connection.password">cerealpass</property>
 <!-- Additional parameters -->
 <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
 <property name="hibernate.show_sql">true</property>
 <property name="hibernate.default_schema">CEREALUSER</property>
  </session-factory>
</hibernate-configuration>

当我尝试使用此配置文件生成 POJO 时,我收到消息来检查我的配置文件,并且 derby.log 给出错误:

java.sql.SQLException: Failed to start database 'C:/CerealDatabase', see the next exception for details.
Caused by: java.sql.SQLException: Failed to start database 'C:/CerealDatabase', see the next exception for details.
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database C:\CerealDatabase.

在尝试此操作之前,我已经关闭了与数据库的任何其他连接,并且当时没有“db.lck”锁定文件,这表明据我所知,没有与数据库的连接。

有人有什么想法吗?帮助感激不尽。

I've created a local Apache Derby database in Netbeans, but am having problems when I try and autogenerate the POJO files, using the "Hibernate Reverse Engineering Wizard".

My Hibernate configuration (generated by Netbeans from the database connection, then I added a few bits):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
 <!-- Default Netbeans generated parameters -->
    <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
    <property name="hibernate.connection.url">jdbc:derby:C:/CerealDatabase</property>
    <property name="hibernate.connection.username">cerealuser</property>
    <property name="hibernate.connection.password">cerealpass</property>
 <!-- Additional parameters -->
 <property name="hibernate.dialect">org.hibernate.dialect.DerbyDialect</property>
 <property name="hibernate.show_sql">true</property>
 <property name="hibernate.default_schema">CEREALUSER</property>
  </session-factory>
</hibernate-configuration>

When I try and generate the POJOs using this configuration file, I get the message to check my configuration file, and the derby.log gives the errors:

java.sql.SQLException: Failed to start database 'C:/CerealDatabase', see the next exception for details.
Caused by: java.sql.SQLException: Failed to start database 'C:/CerealDatabase', see the next exception for details.
Caused by: ERROR XSDB6: Another instance of Derby may have already booted the database C:\CerealDatabase.

I've closed any other connections to the database before trying this, and there is no "db.lck" lock file at the time, which indicates there are no connections to the database as I understand it.

Does anyone have any ideas? Help gratefully received.

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

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

发布评论

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

评论(1

酒解孤独 2024-09-04 02:24:41

Derby 确实使用“锁定文件”来记录数据库何时被进程主动打开。您确定没有db.lck文件吗?除了那种情况外,我从未见过此消息。

作为一个实验,如果从 jdbc URL 中删除 C: 并仅使用 jdbc:derby:/CerealDatabase 作为 URL,会发生什么情况?

Derby indeed uses a "lock file" to record when the database is actively open by a process. Are you sure that there is no db.lck file? I haven't ever seen this message except in that case.

As an experiment, what happens if you remove the C: from your jdbc URL and just use jdbc:derby:/CerealDatabase as the URL?

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