Mita_
Mita_

Reputation: 803

Distributed application in a LAN with one DB server

I plan on making a distributed application where 10-15 computers are connected in a LAN and there is one server where the database will be stored, also inside the LAN. For the purpose of the question lets say the application will be made using Java and the database will be MySQL, but that is not yet decided.

So the question is, what do I need to realize this? I have ofcourse worked with MySQL databases, but on a single computer so I am not quite sure how to connect the computers to the database server. Is it enough to setup the server local IP on all client computers and connect to it using the JDBC MySQL driver, and after that I can work with it like the DB is on my machine?

Also, do I need a server application to manage connections to the database, so that there are no conflicting entries? And if I do, then the connection part changes, because it needs to be established over the server application, so how do I do that?

I know it is a large question, but a lot of things seem unclear, because I have never attempted a project this big.
Thank you all!

Upvotes: 2

Views: 891

Answers (1)

Youcef LAIDANI
Youcef LAIDANI

Reputation: 59960

Don't worry just made your application, you can connect to your database via an @IP, so just make a part of configuration in your application to change some information in future:

String db_url = "jdbc:mysql://192.168.0.1/db_test";

Is it enough to setup the server local IP on all client computers and connect to it using the JDBC MySQL driver, and after that I can work with it like the DB is on my machine

You don't need a server local of every computer, you can connect to the server directly.

Also, do I need a server application to manage connections to the database, so that there are no conflicting entries? And if I do, then the connection part changes, because it needs to be established over the server application, so how do I do that?

If you are using a desktop application, the you don't need a server application, else if you are using a web application, yes you need one.

  • You need to shouse a server application, this dippend of your project or your company, there are free servers like GlassFish, Payara, Apache Tomcat, Wildfly and more.

  • Now the connection to your database, there are many ways to connect to your database, if you are using JPA to connect to your database, then you will hear something about Entities, Facades, JNDI so this generally be configure in your server application.

Hope you get an idea.

Upvotes: 1

Related Questions