简体   繁体   English

具有一台 DB 服务器的 LAN 中的分布式应用程序

[英]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.我计划制作一个分布式应用程序,其中 10-15 台计算机连接在 LAN 中,并且有一台服务器用于存储数据库,也在 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.出于问题的目的,假设应用程序将使用 Java 制作,数据库将是 MySQL,但尚未确定。

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.我当然使用过 MySQL 数据库,但是在一台计算机上,所以我不太确定如何将计算机连接到数据库服务器。 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?是否足以在所有客户端计算机上设置服务器本地 IP 并使用 JDBC MySQL 驱动程序连接到它,然后我可以像数据库在我的机器上一样使用它?

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!谢谢你们!

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:不要担心刚刚制作了您的应用程序,您可以通过@IP 连接到您的数据库,因此只需在您的应用程序中进行配置的一部分,以便将来更改一些信息:

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是否足以在所有客户端计算机上设置服务器本地 IP 并使用 JDBC MySQL 驱动程序连接到它,然后我可以像数据库在我的机器上一样使用它

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.如果您使用的是桌面应用程序,则不需要服务器应用程序,否则,如果您使用的是 Web 应用程序,则需要一个。

  • 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.你需要安装一个服务器应用程序,这是你的项目或公司的一部分,有免费的服务器,比如 GlassFish、Payara、Apache Tomcat、Wildfly 等等。

  • 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.现在连接到你的数据库,有很多方法可以连接到你的数据库,如果你使用 JPA 连接到你的数据库,那么你会听到一些关于 Entities、Facades、JNDI 的东西,所以这通常在你的服务器应用程序中配置。

Hope you get an idea.希望你有想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM