Search code examples
mysqlembedded-database

Portable MySql-Driven App


My father has a small business and asked me to make him a quick program to help automate several of his daily tasks. Due to the nature of these tasks, it absolutely requires a local database (not distributed with connections from multiple clients, just 1 local client and 1 local MySql datastore).

I'm pretty accustomed to MySql programming but have never had to install it and don't really know the details about how it works under the hood.

What I'd like to have is a final deliverable where I send him a folder that has an executable JAR (I've chosen Java since its a good fit here) as well as a preconfigured MySql database on it. I'll run all the scripts, initialize all the tables and populate them, etc. before deploying the the distributable (folder).

This way, no config is necessary for him. My dad gets the folder, plunks it down wherever he wants it on his file system, and double-clicks the JAR to launch the program every time. I will preconfigure the JDBC code to look and connect to the local Mysql database also living under the same root folder ("MyDadsApp/").

Is this even possible to do? If not, why? If so, how?

Here's what I'm thinking as a tentative deployed folder structure:

MyDadsApp/
    MyDadsApp.jar
    res/
        user-manual/
        mysql/
            MyDadsAppDatabase.myd (???) - the actual database
            MySql.exe (???) - MySql Server

Any input/recommendations will be met with open arms!

Thanks


Solution

  • This is actually a perfect scenario for SQLite. It's got a lot less features than MySQL, but it's whole shtick is that it's server-less and self-contained. Sounds perfect for what you're doing.