1

我在 Netbeans 中创建了一个本地 Apache Derby 数据库,但是当我尝试使用“休眠逆向工程向导”自动生成 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”锁定文件,这表明据我所知没有与数据库的连接。

有没有人有任何想法?感激地收到帮助。

4

1 回答 1

0

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

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

于 2010-04-08T13:59:56.743 回答