0

I created a java application that is a front end for a MySQL Database using NetBeans and JDBC.

Now after creating the jar file it runs smoothly on my computer (Since I have the MySQL installed) but, if I run the jar on a different computer it won't work since it does not have the DB the application is using and not even MySQL installed.

So the question is, is it possible to add the database to the executable jar so it will run on any computer without the need for any installation of any software (Except for JRE of course) ?

If yes, how do I go about doing so?

Thanks everyone for the help in advance.

4
  • You should refer this link for this question. [how to create a portable database file from a MySql database][1] [1]: stackoverflow.com/questions/10769344/… Commented Jan 27, 2015 at 6:07
  • 1
    Use any of the freely available pure java database systems (H2, Derby, HSQL); alternatively, connect to a central mysql server over the network. But to answer your question directly, no you can't embed MySQL into your executable jar. Commented Jan 27, 2015 at 6:09
  • @ElliottFrisch So using (H2, Derby, HSQL) unlike MySQL will not require any internet connection for the executable jar to run on a different computer? Commented Jan 27, 2015 at 6:30
  • 1
    @AMS91 Yes, but it may not be an option if any of the data your application needs should be shared amongst the "different computer(s)". Commented Jan 27, 2015 at 6:40

2 Answers 2

1

Use derby database. It already included in JDK's db folder when you installed the Java on your computer.

Sign up to request clarification or add additional context in comments.

Comments

0

If you purely want to use the database without using the MySql then simply using the collections to create database, then you doesn't need any other database client as like MySql. But you need knowledge of Hibernate, Spring etc.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.