Hemlata
Hemlata

Reputation: 377

Unable to generate Hibernate reverse engineering using Embedded Derby connection in NetBeans IDE

I'm using embedded derby with Hibernate but when I try to generate Reverse Engineering after creating Hibernate.cfg.xml I'm getting following error.

Cannot establish database connection with selected Hibernate Configuration file. Please verify the database connection details in hibernate.cfg.xml.

Because of :

Caused by: ERROR XSDB8: Warning: Derby (instance a816c00e-0171-a746-cd67-000019e679e8) is attempting to boot the database may still be active. Only one instance of Derby should boot a database at a time.

I'm connecting Derby Embedded in NetBeans Services> window for creating Hibernate.cfg.xml but when performing Hibernate Reverse Engineering wizard it does connect again but though it could connect successfully in
services> window of NetBeans IDE getting :

Cannot establish database connection with selected Hibernate Configuration file. Please verify the database connection details in hibernate.cfg.xml.

and also :

log contains ERROR XSDB8:

Further even I can connect using DBeaver though I'm facing ERROR XSDB8: so what's wrong only with Reverse Engineering Wizard?

Here is Hibernate.cfg.xml :

<hibernate-configuration>
        <session-factory>
            <property name="hibernate.dialect">org.hibernate.dialect.DerbyTenSevenDialect</property>
            <property name="hibernate.connection.driver_class">org.apache.derby.jdbc.EmbeddedDriver</property>
            <property name="hibernate.connection.url">jdbc:derby:clientieFX;create=true</property>
            <property name="hibernate.connection.username">app</property>
            <property name="hibernate.connection.password">app</property>
        </session-factory>
    </hibernate-configuration>

May it could be achieve configuring in Hibernate.cfg.xml.

I aslo disconnected the instance programitacally using

DriverManager.getConnection("jdbc:derby:;shutdown=true");

That disconnect the connection but further when I repeat Hibernate Reverse Engineering wizard it still giving same error.

So why it cause error though there's no instance is booted anymore?

I'm using NetBeans 11.0, BellSoft JDK 11.0.6+10-LTS, Hibernate 4.3.1.(now updated to 5.4.14) and Derby 10.15.2.0

Upvotes: 0

Views: 527

Answers (1)

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

No, please don't just delete the lock file! It is there for a reason, it is protecting you from accidentally damaging your database!

You are correct, with the Embedded configuration of Derby, only one Java program at a time can have the database open.

The simplest solution is to shutdown the first connection before you make the next connection. Is that possible for you to do?

There are more complex solutions, such as running the Derby Network Server rather than running Derby in the Embedded configuration, but generally I think you should choose the simplest solution that will work for your use case.

For more complete information on the db.lck file: http://db.apache.org/derby/docs/10.15/devguide/cdevdvlp20458.html

Upvotes: 1

Related Questions