Executable Java application (JAR) with database packaged inside

冷暖自知 提交于 2019-12-24 02:22:24

问题


I am developing an application with Swing and MySql. I want to distribute it to the clients, where they could run the application on their end/PC without worrying about installing MySql and other technical stuff. So, I thought of bundling JRE and MySql but then I came across Correctly distributing a Java application with database which says it is not preferable to do so. As it would increase the application size on disk, which obviously is an issue.

So, my questions are

  1. How do I achieve the same and what tool and resources should I use.
  2. Is SQLite a good option?

Any help is appreciated.


回答1:


In my opinion SQLite and Apache Derby (http://db.apache.org/derby/) are both good for such a plan. Some years ago i did such stuff with derby and it's still running. At that time i just packaged the folder that contained the jre, the program, libs (jar's) and the data folder of derby.

As i remember: sqlite was very easy to use whereas derby is more overhead to learn.




回答2:


Please try using HsqlDb visit the link [http://hsqldb.org/ ]

Easy to use and you can embed it into your jar.



来源:https://stackoverflow.com/questions/30323276/executable-java-application-jar-with-database-packaged-inside

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!