In: Computer Science
1.Define each of the following terms :
a. client/server system
b. three-tier architecture
c. deadlock
2.What are the six common steps needed to access databases from a typical program?
3.Contrast fat client and thin client.
1. a. Client/Server Architecture:
As the term portrays the two main elements in this architecture, i.e., client and the server.
Client: A client is the one who requests the server for a particular resource. The client system has a UI (User interface) basically a web browser, to make a request for a particular web page or a website.
Server: A server listens to the clients request and sends back a response to the client because it is the host computer. Thus, the main task for the server is to reply back to the clients requests.
Thus, this model is known as the client server architecture.
b. Three-Tier Architecture:
This architecture has 3 layers/tiers. The 3 layers are:
i. Presentation layer: The front or the top layer is the presentation layer, which is available for viewing. This layer can be accessed by the client in the form of a web browser. This layer is built using JavaScript, HTML (Hyper text markup language) and CSS (Cascading style sheets).
ii. Application layer: This layer contains the core business logic. This layer is written using traditional programming languages like C, C++, Java or .NET
iii. Data layer:
This layer contains the data access layer and the system where the data is stored. Examples of data storage systems are: MYSQL, MongoDB.
API (Application Programming Interface) calls are used to access the data viathe application layer.
c. Deadlock
As the name suggests, a deadlock is a situation where a member of a particular group is holding a resource and is waiting for some other resource which is unavailable as it is being accessed by other process.
There are 4 conditions that are needed for a deadlock:
Resource waiting, Mutual exclusion, No preemption and Hold and Wait.
2. What are the six common steps needed to access databases from a typical program
The following are the steps required to connect and access a database:
i. Importing the packages:
To use the drivers needed to establish a connection, we need to import the respective packages into our program.
ii. Register the driver:
To connect to any database, we need a driver which acts as our connection to the database and our program.
There are 5 types of drivers: Type 1, Type 2, Type 3, Type 4 and Type 5.
Select one of the 5 drivers according to the requirement.
iii. Establish a connection with the database:
Use the DriverManager class and its methods to create the connection object. With this connection object, an established connection between the database and the program can be made.
iv. Create a statement object:
Using this statement object, operations can be performed (inserting data, deleting data) with the database by writing queries. There are 3 types of statements: Statement, PreparedStatement, CallableStatement.
v. Executing the query:
A query is used to perform any CRUD (Create, Read, Update, Delete) operations on the data stored in the database.
So by writing the query in the program we can access the data stored in the database.
vi. Close the connection:
Since we have made an established connection between the database and the program using a connection object. We need to close it to mark the disconnection from the database.
3. Fat client:
Fat client ( popularly known as Thick clients ) is a type of system architecture where a connection can be made to the server without the presence of a network. This is because fat clients are locally installed. They utilise resources of the computer more than a server.
Thin client:
Thin client is a type of system architecture where server based computing is needed to run the system.
Thin clients are more secure than thick (fat) clients.
Thin clients are less expensive than fat clients to deploy.