javadatabaseclientcentralized

Java DB Client-server technology - centralized DB - How?


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


Solution

  • 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.