views:

562

answers:

1

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"&gt;
<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.

A: 

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?

Bryan Pendleton