在java应用程序中嵌入mysql数据库 [英] embed mysql database in java application
问题描述
我使用连接到数据库的 netbeans
创建一个 java
应用程序,但我有一个问题,我想要使用可执行jar文件嵌入 mysql
数据库,所以当我拿这个 jar
文件并在任何没有的pc上运行它没有mysql服务器它将与数据库一起运行,我想包括mysql-installer.exe并制作一个脚本来安装mysql服务器,但我找不到怎么做,我也读过关于Connector / MXJ的事情如果用户运行应用程序并且他没有mysql服务器,任何关于此的建议或文章,它都可以工作。
I make a java
application using netbeans
that connect to database , but i have a problem , i want to embed mysql
database with the executable jar file , so when i take this jar
file and run it on any pc that doesn't have mysql server it will run with database , i thought about include the mysql-installer.exe and make a script to install the mysql server , but i can't find how to do that ,also i read about Connector/MXJ does it work if the user run the application and he does not have mysql server , any suggestion or article about this.
推荐答案
Derby 是一个纯java DBMS。您将derby jar与您的程序捆绑在一起,就像您对其他任何库一样。这是一种更清晰的方法,可以确保您的用户拥有程序的数据库,因为您没有添加任何依赖项。
Derby is a pure-java DBMS. You bundle the derby jar with your program, just as you would any other library. This is a much cleaner way of ensuring your user has a db for your program, as you're not adding any dependencies.
这篇关于在java应用程序中嵌入mysql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!