Java DB 客户端-服务器技术 - 集中式数据库 - 如何实现?

发布于 2024-10-16 06:40:52 字数 340 浏览 3 评论 0原文

我今年有一个项目。它是关于开发一个带有数据库的 Java 应用程序,用于在经理、秘书和财务主管之间共享和验证文档。

我的问题是:如何使所有人都可以访问数据库,因为应用程序将安装在我上面提到的计算机上,我是否必须将它(数据库)安装在这些计算机上?数据库的一致性和完整性的约束将被违反。每次更新后用户将不会拥有相同的副本!

是否有可能(或Java中的技术)将数据库放在网络上并且所有人都可以访问,或者可以从我实现为服务器(客户端服务器)的计算机上访问它。

我将不胜感激您的帮助或提供教程链接。

在此处输入图像描述

I have a project this year. It is about developing a Java application with a database for sharing and validating documents between the manager, secretary and head of finance.

My question is: How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!

Is there a possibility (or technology in Java) to put the database on the web and there will be accessible by all, or make it accessible from a computer that I realize as a server (client-server).

I would be grateful for your help or giving links for Tutorials.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

千里故人稀 2024-10-23 06:40:52

如何使数据库可供所有人访问,由于应用程序将安装在我上面提到的计算机上,我是否必须将它(数据库)安装在这些计算机上?数据库的一致性和完整性的约束将被违反。每次更新后用户将不会拥有相同的副本!

您的问题表明您将需要一台计算机上的一个数据库。我们称其为数据库计算机。我建议这是一台服务器,任何正式员工(例如秘书、经理等)都无法访问。

拥有一个中央数据库将消除您对完整性违规的担忧。

现在,您有两个选择。您可以创建一个 Web 应用程序,您的用户将使用它与您的系统进行交互。这是一种更现代的方法,因为您将拥有一个 3 层系统:

  1. 用户将通过浏览器访问您的应用程序
  2. Web 应用程序本身存储在应用程序服务器上,并且它正在访问数据库数据库
  3. 是后端部分

第二个选项是制作一个桌面应用程序并将其部署到每个将使用它的计算机上;然后让它连接到数据库以与之交互。

当您想要将应用程序公开给大量用户(以及网络)时,第一个选项更容易,但在执行此类操作时知道自己在做什么,因为您必须非常认真地对待安全性。

如果您选择第一种方法,您将需要一些东西:

首先,一个数据库。尽你所能,但如果您需要免费且高质量的数据库,请使用 PostgreSQLMySQL

第二,应用服务器。我建议使用 TomcatGlassFish

现在,您需要使用 JavaEE 开发应用程序。有关于此的信息非常丰富,因此我希望这能在开始时对您有所帮助,并为您指明正确的方向。

请注意,Tomcat 并不完全支持 Java EE,而是支持其中的一个子集。这个子集肯定足以满足您需要完成的任务。

How to make the database accessible by all, since the application will be installed on computers that I mentioned above, do I have to install it (the database) on these computers? The constraints of consistency and integrity of the database will be violated. The users will not have the same copy after each update!

Your question suggests that you will need one database on one computer. Let's call it a DB computer. I'd suggest this be a server, that no one from regular staff, such as secretary, manager, etc... can access.

Having one central database will eliminate your worries about integrity violation.

Now, you have two options. You can make a web application that your users will use to interact with your system. This is a more modern approach, since you'll have a 3 tier system:

  1. users will access your application via a browser
  2. the web application itself is stored on an application server, and it is accessing the database
  3. the database is the backend part

The second option is making a desktop application and deploying it to everybody's computer that will use it; and afterwards making it connect to the database for interacting with it.

The first option is easier when you want to expose your application to a large number of users (and to the web), but know what you're doing when doing stuff like this, since you have to take security very seriously.

If you go the first route, you will need a few things:

First, a database. Use what you can, but if you need free and high quality databases, use PostgreSQL or MySQL.

Second, an application server. I suggest using Tomcat or GlassFish.

Now, you need to develop your application using JavaEE. There is a wealth of information about this, so I hope this will help you in the beginning and point you in the right direction.

Note that Tomcat doesn't support Java EE fully, but a subset of it. And this subset is surely more than enough for what you need to accomplish.

孤星 2024-10-23 06:40:52

如果我理解正确的话,您正在寻找实现客户端-服务器系统的方法,其中不同计算机上的多个客户端各自连接到托管数据库的中央服务器(或服务器集群)。在 Java 中,通常(但不一定)数据库位于 Web 应用程序内部,而客户端是轻量级 Web 客户端 - 在这种情况下,它通常称为企业应用程序

Java 为此有一个完整的专用 SDK,称为 Java Enterprise Edition。您可能会发现许多与此有关的问题,以下是我认为可能特别有用的一些问题:

If I understand you correctly, you are looking for ways to implement a client-server system, where several clients on distinct computers each connect to a central server (or cluster of servers) hosting a DB. In Java, usually (but not necessarily) the DB is inside a web application, and the clients are lightweight web clients - in this case it is usually called an enterprise application.

Java has a whole dedicated SDK for this, called Java Enterprise Edition. You may find many questions dealing with this on SO, here are a few which I think may be especially helpful:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文