patrickfdsouza
patrickfdsouza

Reputation: 747

Desktop app with local and online database

I want to create a Desktop App(Software), preferably in Java, which connects to a central MySQL DB on a local network whenever available.

I also want it to store and use a copy of the same DB when the central DB is not available, and sync whenever the central DB is available.

How can I store data locally, I mean which kind of database should I use for local database?

Also, are there any tools which speed up the Desktop App development?

Upvotes: 0

Views: 882

Answers (2)

Giovanni
Giovanni

Reputation: 203

Let's suppose that you will implement your solution in Java. You will need some classes (i.e. Data Access Obejcts, DAOs) in charge of interacting with the database on the network and on a file based database embedded in the application (the "local" database).

What you need:

  1. A local database that you can ship with your application like H2 www.h2database.com, HSQLDB http://hsqldb.org/ or Derby db.apache.org/derby/.
  2. To develop your DAOs (using JDBC or Hibernate) in such a way that you can instantiate them with different drivers, URLs, login/pwd and use only SQL standard / functions supported both by MySql and by the local DBMS. In practice you must avoid using DB specific functions.

Upvotes: 1

Michał Szydłowski
Michał Szydłowski

Reputation: 3409

You can use Hibernate or JPA for example, they have quite a nice and easy integration with your application.

Upvotes: 0

Related Questions