简体   繁体   English

如何更新Derby数据库的版本

[英]How to update the version of a Derby database

When trying to create a table with a Boolean field, I've come across a Derby error that prompts me to update the database version from 10.3 to 10.7. 尝试使用布尔字段创建表时,遇到了Derby错误,提示我将数据库版本从10.3更新到10.7。 I've found this question which apparently contains the solution: 我发现这个问题显然包含解决方案:

Tables for entities with boolean fields not created 未创建具有布尔字段的实体的表

but I can't see the syscs_get_database_property procedure in the syscs_util database. 但是我在syscs_util数据库中看不到syscs_get_database_property过程。 I've taken a quick look to Derby docs and I haven't found any reference to "update" or "version" in them. 我快速浏览了Derby文档,但在其中没有找到对“更新”或“版本”的任何引用。

I can't/don't want to rename/lose the database just to get the database updated, like the other thread proposes to fix the problem; 我不能/不想重命名/丢失数据库只是为了更新数据库,就像另一个线程建议解决该问题一样; also, I don't use JPA to create the schema. 另外,我不使用JPA创建架构。 Is there any way to actually update the database (whichever that means)? 有什么方法可以实际更新数据库(无论哪种方式)? I'm using the latest Java SE 8 Java DB/Derby JARs in NetBeans, defined as a library used in my desktop application, just changed from Java SE 7. 我正在NetBeans中使用最新的Java SE 8 Java DB / Derby JAR,它定义为我的桌面应用程序中使用的库,只是从Java SE 7进行了更改。

TIA TIA

要将数据库升级到较新版本,请遵循此处的文档: http : //db.apache.org/derby/docs/10.11/devguide/cdevupgrades.html

In your DB url just add this string 在您的数据库网址中,只需添加此字符串

private static final String DB_URL = "jdbc:derby:mydatabase;upgrade=true"; 私有静态最终字符串DB_URL =“ jdbc:derby:mydatabase; upgrade = true”;

Run this at the first time..There won't be no error anymore.. 第一次运行。.不会再有错误了。

Replace it back to it pevious String 替换回它以前的字符串

private static final String DB_URL = "jdbc:derby:mydatabase;create=true"; 私有静态最终字符串DB_URL =“ jdbc:derby:mydatabase; create = true”;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM