🏗️ Database Architecture
Two-Tier • Three-Tier • ANSI/SPARC Three-Level Architecture
What is Database Architecture?
Database architecture describes how users, applications, database servers, and stored data are organized and communicate with each other.
👉 Click a button below to explore each architecture.
Database architecture describes how users, applications, database servers, and stored data are organized and communicate with each other.
👉 Click a button below to explore each architecture.
🖥️ Two-Tier Database Architecture
Definition:
Two-tier architecture divides the database application into
two major layers:
1. Client
2. Database Server
1. Client
2. Database Server
🏗️ Architecture Diagram
CLIENT
User Interface
Application Logic
User Interface
Application Logic
↓
DATABASE SERVER
DBMS
Database
DBMS
Database
⚙️ How It Works
Step 1:
The user interacts with the client application.
Step 2:
The client creates a database request.
Step 3:
The request is sent directly to the database server.
Step 4:
The database server processes the query.
Step 5:
The result is returned directly to the client.
The user interacts with the client application.
Step 2:
The client creates a database request.
Step 3:
The request is sent directly to the database server.
Step 4:
The database server processes the query.
Step 5:
The result is returned directly to the client.
📌 Example
A desktop banking application directly connected to a
database server.
Client → Database Server
Client → Database Server
✅ Advantages
- Simple architecture.
- Easy to develop for small applications.
- Fast communication in small networks.
- Lower architectural complexity.
❌ Disadvantages
- Less scalable for large systems.
- Security can be harder to manage.
- Business logic may reside on the client.
- Maintenance becomes difficult when many clients exist.
🎯 Uses
- Small office applications
- Desktop database applications
- Small banking systems
- Small inventory systems
🏢 Three-Tier Database Architecture
Definition:
Three-tier architecture separates the application into
three layers:
1. Presentation Layer
2. Application Layer
3. Database Layer
1. Presentation Layer
2. Application Layer
3. Database Layer
🏗️ Architecture Diagram
PRESENTATION LAYER
Web Browser
Mobile App
User Interface
Web Browser
Mobile App
User Interface
↓
APPLICATION LAYER
Business Logic
Validation
Processing
Business Logic
Validation
Processing
↓
DATABASE LAYER
DBMS
Database
DBMS
Database
⚙️ How It Works
Step 1 – Presentation
The user enters information through a web page or application.
↓
Step 2 – Application
The application server validates the request and applies business rules.
↓
Step 3 – Database
The application server sends a query to the database.
↓
Step 4 – Response
The result travels back through the application layer to the user interface.
The user enters information through a web page or application.
↓
Step 2 – Application
The application server validates the request and applies business rules.
↓
Step 3 – Database
The application server sends a query to the database.
↓
Step 4 – Response
The result travels back through the application layer to the user interface.
📌 Example
Online shopping:
Customer ↓ Website ↓ Application Server ↓ Database
Customer ↓ Website ↓ Application Server ↓ Database
✅ Advantages
- Better security.
- Highly scalable.
- Easy maintenance.
- Business logic is separated from the user interface.
- Suitable for large web applications.
❌ Disadvantages
- More complex than two-tier architecture.
- Requires additional servers or services.
- Higher development cost.
- Communication between layers can introduce overhead.
🎯 Uses
- E-commerce websites
- Online banking
- College management systems
- Hospital management systems
- Large enterprise applications
🏛️ ANSI/SPARC Three-Level Architecture
Definition:
The ANSI/SPARC architecture divides a database system into
three levels of abstraction.
The three levels are:
External Level
Conceptual Level
Internal Level
The three levels are:
External Level
Conceptual Level
Internal Level
🏗️ Three Levels
EXTERNAL LEVEL
User Views
Different users see different parts of the database.
User Views
Different users see different parts of the database.
↓
CONCEPTUAL LEVEL
Logical Database Structure
Entities • Relationships • Constraints
Logical Database Structure
Entities • Relationships • Constraints
↓
INTERNAL LEVEL
Storage Structure
Indexes • Files • Storage Organization
Storage Structure
Indexes • Files • Storage Organization
↓
PHYSICAL STORAGE
Disk / SSD / Storage Devices
Disk / SSD / Storage Devices
1️⃣ External Level
The external level describes how individual users view the
database.
For example:
Student: Name, Roll, Marks
Teacher: Name, Roll, Marks, Attendance
Different users can have different views of the same database.
For example:
Student: Name, Roll, Marks
Teacher: Name, Roll, Marks, Attendance
Different users can have different views of the same database.
2️⃣ Conceptual Level
The conceptual level describes the complete logical structure
of the database.
It includes:
It includes:
- Entities
- Attributes
- Relationships
- Constraints
3️⃣ Internal Level
The internal level describes how data is physically stored.
It deals with:
It deals with:
- Files
- Indexes
- Storage blocks
- Access paths
🔄 Data Flow
User
↓
External Level
↓
Conceptual Level
↓
Internal Level
↓
Physical Storage
⭐ Main Objective
The main objective of ANSI/SPARC architecture is to provide
data abstraction and data independence.
🔐 Data Independence
Physical Data Independence
Changes in physical storage should not require changes to the conceptual schema.
Example:
Changing an index or storage method should not change the logical database design.
Logical Data Independence
Changes in the conceptual schema should have minimal impact on external user views.
Changes in physical storage should not require changes to the conceptual schema.
Example:
Changing an index or storage method should not change the logical database design.
Logical Data Independence
Changes in the conceptual schema should have minimal impact on external user views.
✅ Advantages
- Provides data abstraction.
- Supports data independence.
- Different users can have different views.
- Improves database security.
- Separates logical design from physical storage.
❌ Disadvantages
- Architecture is conceptually complex.
- Requires careful schema management.
- Additional abstraction layers can increase complexity.
🎯 Uses
- Large database systems
- Enterprise databases
- University databases
- Banking systems
- Hospital information systems
📊 Quick Comparison
| Feature | Two-Tier | Three-Tier | ANSI/SPARC |
|---|---|---|---|
| Purpose | Application architecture | Application architecture | Database abstraction |
| Layers | 2 | 3 | 3 levels |
| Main Components | Client + Database | Client + Application + Database | External + Conceptual + Internal |
| Focus | Communication | Separation of application logic | Data abstraction |
| Typical Use | Small applications | Web / Enterprise applications | Database system design |
No comments:
Post a Comment