I have written an application in java Swing that runs in 8 machines under a Local Area Network and accesses a mysql db. The program is running fine. But, now my client has decided to set up a new branch at a distant location which should be connected to the existing branch. How can I modify/extend my application to handle that situation. client wants to use it in normal internet connection.any ideas will be great help.
Asked
Active
Viewed 1,029 times
2 Answers
5
You should not connect directly from the Swing clients to the database. It's better if you implement a service to communicate with the database, and the Swing application communicate with the service.
The easiest thing may be to set up a web server, and communicate with JSON using an Apache HTTP Client in your Swing application. That is what I'm using.
In summary you need three parts:
- Swing client application, that has a built in HTTP Client. Communicates with a web server.
- A web server that responds to requests from client applications and is connected to the database via JDBC
- The database itself.
As Ajay suggests, the deployment will be easier if you use Java Web Start.

Jonas
- 121,568
- 97
- 310
- 388
-
thanks...alot....no worries if we don't know json ...just if we can upload sql file rather then sending json...everything willbe easy..thanks for the great idea. – Mohamed E-Zumry Dec 19 '11 at 06:13
1
Use Java Web Start. The client would download the jnlp file and open the GUI using that
Also have a clear separation between your view and model. Your client will talk to a service which can give you the data from the DB.

Ajay George
- 11,759
- 1
- 40
- 48
-
thanks...alot....no worries if we don't know json ...just if we can upload sql file rather then sending json...everything willbe easy..thanks for the great idea. – Mohamed E-Zumry Dec 19 '11 at 06:14