簡體   English   中英

無法使用 NetBeans IDE 中的嵌入式 Derby 連接生成 Hibernate 逆向工程

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

我正在使用帶有Hibernateembedded derby ,但是當我在創建Hibernate.cfg.xml后嘗試生成逆向工程時,我遇到了以下錯誤。

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

因為:

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
服務> window 的NetBeans IDE得到:

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

並且:

日志包含ERROR XSDB8:

此外,即使我面臨ERROR XSDB8:也可以使用DBeaver進行連接:那么只有逆向工程向導有什么問題?

這是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>

可以在Hibernate.cfg.xml中實現配置。

我還使用編程方式斷開了實例

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

斷開連接,但當我重復Hibernate Reverse Engineering向導時,它仍然給出相同的錯誤。

那么為什么它會導致錯誤,盡管沒有實例被啟動了呢?

我正在使用NetBeans 11.0BellSoft JDK 11.0.6+10-LTSHibernate 4.3.1.(now updated to 5.4.14)Derby 10.15.2.0

不,請不要只刪除鎖定文件,它的存在是有原因的,它可以保護您不被意外損壞數據庫!

您是對的,使用 Derby 的嵌入式配置,一次只有一個 Java 程序可以打開數據庫。

最簡單的解決方案是在建立下一個連接之前關閉第一個連接。 你可以這樣做嗎?

還有更復雜的解決方案,例如運行 Derby Network Server 而不是在嵌入式配置中運行 Derby,但通常我認為您應該選擇適合您的用例的最簡單的解決方案。

有關 db.lck 文件的更多完整信息: http://db.apache.org/derby/docs/10.15/devguide/cdevdvlp20458.ZFC35FDC70D5FC69D235EZCZ8A3

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM