使用Netbeans中的Hibernate配置文件连接到Apache Derby的问题(​​ERROR XSDB6)

时间:2010-04-08 09:07:42

标签: hibernate netbeans derby

我在Netbeans中创建了一个本地Apache Derby数据库,但是当我尝试使用“Hibernate Reverse Engineering Wizard”自动生成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”锁定文件,这表示根据我的理解,没有与数据库的连接。

有没有人有任何想法?感激不尽。

1 个答案:

答案 0 :(得分:0)

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

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