Neha Kaushik
Neha Kaushik

Reputation: 21

java apps with mysql database

I have prepared an application that is a small demo of Student information manipulation. I have stored information related to students in a MySQL DB. Now my application is working 100% on my computer. But I want that work everywhere without depending on Database! I mean I just want "WHEREVER MY .JAR FILE GOES, DATABASE SHOULD ALSO GO ALONG WITH THAT INSIDE .JAR FILE "

So anyone who is using my application or trying it, they can realize exact result of this application.

How can I make this possible? Please someone help me.

For that I have done the following things:

I have installed MySQL database on my computer.

I have created a database on that MySQL server

I have created some tables in the database with a lots of data.. this data is to be used in my whole application, even for login.

Now I want to deliver this application to various clients but my clients are not technical persons and I don't want to give instructions to each of my client to do the above four steps.

How can I integrate some functionality into my app so that they can use my database, Tables and Data automatically .

It would be much better if the code can install the MySQL database automatically from the setup file attached with the application.

How the applications available in the market manage information

Upvotes: 2

Views: 1249

Answers (2)

tutiplain
tutiplain

Reputation: 1480

I have two suggestions for you:

A. Use SQLite instead of MySQL. SQLite is an embeddable database engine and does exactly what you need. You can simply copy the .sqlite file where all the information is stored and distribute it with your JAR file. Given that you've already written you app to use MySQL, this could mean making a few changes to your code.

There is a good SQLite jdbc driver at: https://bitbucket.org/xerial/sqlite-jdbc

I've used it before, though not extensively.

B. Use a portable installation of MySQL. If you are using Windows these are available on the MYSQL page, look for the downloads marked "ZIP Archive" instead of "MSI Installer". These versions are portable in that they do not require an installation process, just unzip the file, and start the service. Your clients need to know how to start it up, of course. Perhaps you could create a shortcut for that.

Of course, the idea of MySQL being a network server is so that everyone in the enterprise works with the same data, by connecting to the same server. If your clients will use this application in various computers in the same company, you should consider having a single MySQL Server installed, and making the clients connect to that.

Hope this helps!

Upvotes: 0

fsaravia
fsaravia

Reputation: 735

Have you thought of using another database engine? MySQL requires the server to be installed and configured, and it is a huge task to be done by an automatic installer. What about using for example SQLite http://www.sqlite.org/ or Apache Derby http://db.apache.org/derby/. Both of them work by creating a file in your working dir, you could setup the database and populate data at install time

Upvotes: 1

Related Questions