Search code examples
javajdbcarchitecture3-tier2-tier

Oracle JDBC Tutorial - Want to understand 2 tier JDBC vs 3 tier


I am reading the oracle JDBC tutorial here - http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html

Please refer to Figure 2: Three-tier Architecture for Data Access.

It says that -

In the three-tier model, commands are sent to a "middle tier" of services, which then sends the commands to the data source. The data source processes the commands and sends the results back to the middle tier, which then sends them to the user. MIS directors find the three-tier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that it simplifies the deployment of applications. Finally, in many cases, the three-tier architecture can provide performance advantages.

I don't understand the bold parts. What is the logic behind those points ?

- middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. --In what ways ?

- simplifies the deployment of applications -- How does that simplify deployment ?

- three-tier architecture can provide performance advantages. -- You just added a layer between two tiered arch. Now, instead of direct communication between code and DB there is a middle layer. So, should'nt that reduce your performance/speed ?


Solution

    • middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. --In what ways ?

    Consider these roles:

    Workers can add low level data but can't add other workers.

    Managers can add/update low level data but can't see the high level stats.

    Executives can't update low level data, can't add workers but can see the high level stats.

    The same can be in the world of components: loggers are write-only, some components can't access data of the other components, etc.

    • simplifies the deployment of applications -- How does that simplify deployment ?

    Each layer provides an interface to its clients. If you change the internal implementation of the layer not touching its interface, the update can be completed seamlessly for the clients.

    • three-tier architecture can provide performance advantages. -- You just added a layer between two tiered arch. Now, instead of direct communication between code and DB there is a middle layer. So, should'nt that reduce your performance/speed ?

    There are two ways to improve performance: vertical and horizontal scalability (google it). Here we talk about the horizontal one, it's hardly possible with two layered architecture.