简体   繁体   English

如何在jar文件中嵌入数据库derby

[英]How to embed database derby in jar file

I do not want to install a database server on target machine. 我不想在目标计算机上安装数据库服务器。 It is possible that we can simply ship a jar file with the database embedded in it, and not worry about installing a database server separately? 可能我们可以简单地附带一个嵌入了数据库的jar文件,而不必担心单独安装数据库服务器吗?
I created one application in netbeans using derby and it is working fine in my pc but when i am running on other machine it is giving me Error connecting to server localhost on port 1527 --> this error says that there is no Database running on port 1527. but i dont want that the client should take more efforts to start DB server and all technical process. 我使用derby在netbeans中创建了一个应用程序,并且在我的PC上运行正常,但是当我在另一台计算机上运行时,这给我提供了Error connecting to server localhost on port 1527 --> this error says that there is no Database running on port 1527.但是我不希望客户端应该花更多的精力来启动DB服务器和所有技术流程。 It should be simply runnable when i start application Derby DB should start and when i close DB should close. 当我启动应用程序Derby DB应该启动以及当我关闭DB应该关闭时,它应该可以简单地运行。
So what will be the solution for my problem? 那么,解决我的问题的方法是什么?
And one more Question is Can i use derby database for large scale projects? 还有一个问题是,我可以在大型项目中使用derby数据库吗?

No, you don't have to install a database server on the target machine; 不,您不必在目标计算机上安装数据库服务器; Derby works just fine in embedded mode without a separate server. 在没有单独服务器的情况下,Derby在嵌入式模式下也可以正常工作。

However, if you want multiple client applications to be actively sharing the same data in the same database, you'll want to use the client-server mode, not the embedded mode. 但是,如果希望多个客户端应用程序主动共享同一数据库中的相同数据,则需要使用客户端-服务器模式,而不是嵌入式模式。

And yes you can embed a jar with the database into your program. 是的,您可以将带有数据库的jar嵌入程序中。 If you want to know how, read this documentation: http://db.apache.org/derby/docs/10.11/devguide/cdevdvlp24155.html 如果您想知道如何使用,请阅读以下文档: http : //db.apache.org/derby/docs/10.11/devguide/cdevdvlp24155.html

And yes you can use Derby for large scale projects. 是的,您可以将Derby用于大型项目。 But it doesn't come with all the enterprise features (online backup, etc.) that a true enterprise scale commercial DBMS comes with. 但是,它并没有真正的企业级商业DBMS附带的所有企业功能(在线备份等)。

But, since it sounds like you are just getting started with Derby, can I suggest that you please start with the Derby tutorials before you try these advanced configurations? 但是,由于听起来您刚刚开始使用Derby,所以我可以建议您在尝试这些高级配置之前先从Derby教程开始吗? Here is the link to the Derby tutorials: http://db.apache.org/derby/docs/10.11/getstart/ 这是Derby教程的链接: http : //db.apache.org/derby/docs/10.11/getstart/

It may not be possible to give you very good advice without knowing a lot more about the application you're trying to build and the overall architecture you're trying to use. 如果不对正在尝试构建的应用程序和正在尝试使用的整体体系结构有更多了解,可能无法为您提供很好的建议。

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

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