I want to use MySQL for my Java app, but is very important that the user hasn't to start or install any program before start the app, so, How can I install MySQL (If it's necessary) and start the MySQL server directly by code? Have I to use other database?
-
2If you could do this, you could install all sorts of things the user didn't want or ask for.Sotirios Delimanolis– Sotirios Delimanolis2013-04-24 18:27:28 +00:00Commented Apr 24, 2013 at 18:27
-
1H2 ? h2database.com/html/main.html or SQLite?leonbloy– leonbloy2013-04-24 18:28:54 +00:00Commented Apr 24, 2013 at 18:28
-
But I only want to launch the installer directly, namely, I want the user only has to click in next, I'm not interested in do it in background.jramirez– jramirez2013-04-24 18:30:23 +00:00Commented Apr 24, 2013 at 18:30
-
Maybe you can do with a "small" sql solution like SQLite (sqlite.org)? Maintaining a full blown MySql server is maybe overkill? Just a thought...luksch– luksch2013-04-24 18:30:31 +00:00Commented Apr 24, 2013 at 18:30
-
I'd go with HSQL/H2 as mentioned by leonbloy. You can have it persist to file so the data will still survive them resetting the application as well.Erich– Erich2013-04-24 19:07:38 +00:00Commented Apr 24, 2013 at 19:07
2 Answers
MySQL has released this presentation dealing with details on how to do it if needed. It lists these three options:
- Embedded library
- Silent windows install
- Launch mysql form command line
Check the presentation for details (the .pdf in the .zip linked at the page).
Note that you have to be licence compliant also to do this. GPL for GPL, commercial for commercial.
Comments
You can use something like the Nullsoft Scriptable Install System (NSIS) to install MySQL on the user's computer, along with your Java application. Your Java application would have to create all of the tables needed by your Java application.
Your other alternative is to use a Java embedded database, like HSQLDB. Your user would just install your Java application.