Mysql in Java Desktop applications for multiple establishments

Asked

Viewed 491 times

0

Hello, if I make a Java Desktop application with a Mysql database, which will be delivered to several establishments to use, what about the database? Do you have any suggestions? The application, I can make it be installed easily, but what about the database part? Each location will have to install Mysql and also create the necessary tables?

1 answer

2


Depends what you want. If each establishment must have its database independent, then the database is installed on a physical server within the establishment and the terminals connect to it via an IP of the type 192.168.X. X. Another possibility is that each establishment chooses to host somewhere outside (such as some cloud computing server), but hence requires an internet connection and not just a local network.

If you want all of them to use the same Mysql database, you host it somewhere (possibly in some cloud computing service) and then all connect to it via the public IP or hostname that you diponibilize.

Anyway, it all comes down to the connection string: jdbc:mysql://<host-do-servidor>:3306/<nome-do-seu-database>. In place of <host-do-servidor> you put the server IP or hostname of the same. You can leave the IP or hostname fixed in the source code or you can read it from a configuration file.

When creating tables, you would create them as part of the Mysql installation process. If you are going to install a Mysql in each establishment, then on that occasion you would create the tables. If you’re going to make a single location where everyone accesses, you only need to create the tables once.

In addition, you should also keep an eye on security. If you have several different locations sending type instructions INSERT, UPDATE, DELETE and SELECT to a single centralized place, it’s very easy for someone to find a way to send instructions like this out of your program. Just have the username, password and connection string that can be recovered from within the program easily. This is why applications are often used server-side that access the database exclusively and client applications should only communicate through the application on the server: This ensures the encapsulation of the database.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.