A
A
Anton Vedenichev2019-02-08 15:54:02
Java
Anton Vedenichev, 2019-02-08 15:54:02

What are the steps for creating a client-server application in Java?

The essence of the task, I have a desktop application, it connects to a local database (MySQL), reads information from it and processes it.
Those. only I can use this application from my local device. The task is this:
The n-th number of users must have a client, they have the ability to change data through this client in tables, which is displayed in the database. The database and the server must be available to different devices at any given time. Connected to the Internet, connected to a remote server and work with data.
The question is this. What steps need to be taken and how best to implement the whole thing. I am a complete zero in client-server development, I apologize for my incompetence.
Example:
Step 1. You need to find a remote host (or deploy it on your device) on which your recommended database will be (MySQL) and register access to the remote database in your client applications.
Can you tell me the materials that can be checked on this topic, what is the general algorithm for creating this application and what technologies are better to use.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Frozen Coder, 2019-02-08
@toxi_vedenicheva

You need a server application that will provide remote clients with access to the database, but not directly, but through itself by communicating with clients via http using REST (easier) or SOAP. Those. clients send requests and receive responses from the server. The server is located (deployed) on a remote machine in some cloud or where you deploy it. There will also be a database next to it, about which only your server application will know, but not your clients. Clients only know about the application, or rather, where to knock, what to send and what to expect in response.
Google towards Spring Boot, Spring Data. You will also most likely need an authentication and authorization mechanism if you want only your clients to be able to work with the application. Then we also look towards Spring Security.
First read about http, then about REST. If you just pull the database, then there is a super-simple solution - Spring Data Rest, which will generate all requests and even api for you. You will only need to describe the entities (read about JPA and its annotations) and declare the interfaces of the repositories and set some binding settings in the properties.
Here is a good simple example: spring-projects.ru/guides/accessing-data-rest . There are source codes on github, take them, poke them, rewrite them for yourself.
When the server is ready, it remains to teach your desktop application to pull the apish of your server via http - send requests and process responses. I didn’t work with desktop applications, but Google can easily tell you some http client library - some okhttp.

N
nozzy, 2019-02-08
@nozzy

https://habr.com/en/post/257223/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question