如何检测我正在使用的 JavaDB/Derby 版本?

发布于 2024-09-28 10:00:02 字数 140 浏览 0 评论 0原文

我在 Java Swing 应用程序中使用 JavaDB (Derby) 作为嵌入式数据库。我想检测并打印我正在使用的 JavaDB 版本。我已将 derby.jar 包含在应用程序的 .jar 文件中。

如何检测并打印嵌入式 JavaDB 的版本?

I use JavaDB (Derby) as an embedded database in my Java Swing application. I would like to detect and print the version of JavaDB I'm using. I have included derby.jar in my .jar-file for the application.

How can I detect and print the version of my embedded JavaDB?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

另类 2024-10-05 10:00:02

http://download.oracle .com/javadb/10.6.1.0/javadoc/jdbc3/org/apache/derby/tools/sysinfo.html

String version = sysinfo.getVersionString();

也可以从命令行运行:

java -jar yourjarfile.jar org.apache.derby.tools.sysinfo

如果你不想要编译时依赖,你可以还可以从 JDBC DatabaseMetaData 获取版本信息:

 conn.getMetaData().getDatabaseMajorVersion(); // and friends

http://download.oracle.com/javadb/10.6.1.0/javadoc/jdbc3/org/apache/derby/tools/sysinfo.html

String version = sysinfo.getVersionString();

Can also be run from the command line:

java -jar yourjarfile.jar org.apache.derby.tools.sysinfo

If you do not want the compile-time dependency, you can also get the version info from the JDBC DatabaseMetaData:

 conn.getMetaData().getDatabaseMajorVersion(); // and friends
季末如歌 2024-10-05 10:00:02

您还可以 直接使用SQL检测产品版本

select getdatabaseproductversion() from (values (1)) t (a);

You can also detect the product version directly using SQL:

select getdatabaseproductversion() from (values (1)) t (a);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文