I've been developing a Java desktop app from some time and basically what it does is to CRUD data of a MySQL database online. My problem now is security, I don't want to hardcore any user information on the client app. I'm thinking of two ways of doing this:
Harcode most of the MySQL statements in the client app and use the server app to transfer user and password information to the client, so the client can connect directly to the database. Which I don't like that idea because I don't want the user to have any way of getting database credentials.
Using a 3-tier architecture. I have the client app almost fully coded, I have the server running on MySQL, now I need a middle layer to handle all the logical operations, credentials and everything and for that to communicate with the client app, example: if the client app asks for an inventory list, then the server check it's credentials and send the client app a file with all the inventory.
My problem is this:
- Which component should I use to achieve option 2? I've been told to use Servlets, I've been reading about that but will that be the best option? Servlets are used for web apps and I don't know how can I get my client-app (which would be run on a desktop) communicate with Servlets and receive the data?