(This is the second article in the DBMS series, read the first article here to understand about basics of DBMS)
Spoiler: There is a challenge at the end of this article, read it completely to get the correct answer!
Recap : In the previous article, we read about the importance of DBMS and its advantages, drawbacks of file systems, and real-life applications of DBMS.
In this article we will learn about :
- How do we access data from a Database
- Different kinds of DBMS architecture
- Importance of DBMS architecture
From the previous article we understood the meaning of DBMS as the ability to access and modify the database, but how exactly are we doing this? Are we directly able to alter the data in the huge Database? The answer is certainly NO because a Database consists of a lot of sensitive information that cannot be shared or modified by any random user.
Here comes the role of Database Architecture as it describes the structure and how the users are connected to a specific database system. It is important to understand the Database architecture of a specific application as it allows us to:
- Design a database with proper implementation
- Develop a design that is cost-effective and also easy to implement
- Maintain the database that includes recovery management, and memory allocation.
Just like the architects design and develop the layout of the construction, even the Database Administrators design the Database before allowing it to store data. This determines the structural integrity and durability of the entire complex, i.e., the architecture defines the structure's performance.
Types of DBMS architecture :
Due to security constraints, DBMS doesn't allow every user to make changes to the Database, there are multiple levels of Abstraction that allow restricted access and also enable the working of a tier-based classification The 3 types of architecture are:
- Single Tier Architecture
- Two-Tier Architecture
- Three-Tier Architecture
- The most straightforward architecture
- The database is directly accessed by the end user/client
- Due to this direct connection between the server and end-user, the response time is the least i.e., the response is received in very less time and very fast.
- Every change made by the user is directly reflected in the database and all processing is done on a single server
- This database management system is also known as the local database system.
To learn SQL we set up our SQL server and the database on our local system, every change made by us through queries is reflected directly on the database, this whole setup used to learn SQL queries is an example of Single tier Architecture.
Similar to the concept of Client-Server architecture, where the client is the end user and the Server is the database which provides functionality to perform operations on the database via APIs (Application Programming Interface)
(Example of APIs in real life: Embedding YouTube into a webpage)
APIs are the intermediate stage between client and server that help in communication between the both, for example:
- ODBC: Open Database Connectivity.
- JDBC: Java Database Connectivity. Client-side applications can access the database server directly with the help of API calls, making the application independent of the database.
Going back to our Railway Ticket Reservation example, we usually use a web browser to book a ticket, in such a case our device acts as a client and the whole Railways database acts as the server which stores the information of every passenger. Another way of booking a ticket is by physically going to the Railway Station and filling the form, in such a case the ticket counter machine acts as a client that sends data to the Server, hence there can be multiple clients for the same server and a set of APIs makes it easier for us to access and store data into the Database.
Three-Tier DBMS Architecture is the most widely used DBMS architecture in which another layer known as the Application layer is added between the server (Database Layer) and the client (Presentation Layer) systems.
This application or business layer provides the end-user an abstract view of the database.
The requests sent by the users are checked and verified by the Intermediate Layer before transferring them to the server.
The major advantage of this architecture is the reduced load on the Query processor enhancing the Database Design and security.
Major advantages of three-tier architecture :
Scalability: the ability to expand the capacity of a database system to support larger amounts or requests and/or store more data without sacrificing performance.
Data Integrity: The database shouldn't be inconsistent at any point and should always maintain integrity, and shouldn't contain redundant data
Security: Not all the users are directly allowed to access the database due to multi-level abstraction.
Gmail, when we login into our accounts we don't know where our data has been stored and how are we able to log in directly through a password, this is taken care of by the business layer of the three-tier architecture.
Summing it up:
- DBMS Architecture describes the structure and how users are connected to a database system
- Database Architecture affects the performance of the Database
- Single Tier architecture is the most straightforward architecture and every change made by the end user is reflected in the database.
- Two Tier Architecture implements a client-server approach through APIs
- Three Tier Architecture is an extension of Two Tier Architecture which introduces the Business Layer or the Application Layer between the client and server systems, mostly used these days.
The Coding Minutes Website comes with which Tier Architecture?
A. Single-Tier Architecture
B. Two-Tier Architecture
C. Three-Tier Architecture
(Give your answer in the comments section, the one with the best explanation will have a special mention in the next article!)