Objectives:
To review file I/O basics
To simulate a database service by using any method like the one given in the requirements OR by using Threads OR by simple File handling using multiple programs at the same time. Description:
Method 1:
You will write a clientserver software system that demonstrates how a database system normally operates in a network environment. Generally, a database system runs as a service that responds to requests from an arbitrary list of sources. It is up to the database system to make sure data is secure and integrity is maintained. For example, only those sources that are permitted should access or update the data; and only one source can update data at a time even though several sources may be requesting to update at the same time.
Method 2:
You can write a program that uses Threads for accessing and updating the same text file by many processes.
Method 3:
Write down programs that try to access the same file simultaneously running with each other. So, in effect you will be needing one program/application that creates a text file and then other applications/programs that can access and update the contents. You can use three applications/programs for this purpose.
Requirements:
- The database file consists of records with the following fields:
- MemberID (as an integer)
- FirstName (as a variable length string) C. LastName (as a variable length string)
- DateOfBirth (as a Date format supported by your OS)
- Write a server program that will run continuously, listening for requests to write to the database. There are only 3 requests that the server can respond to:
- INSERT allows the insertion of new data. The data should be provided only as the FirstName, LastName and DateOfBirth. The MemberID is automatically generated and written to the file with the rest of the data. The automatically generated MemberID must be sequential.
The server should only handle up to 40,000 records. This means that IDs of 140,000 would be valid.
If the INSERT command is not successful, an error should be returned to the client.
- UPDATE allows the modification of existing records. The client must provide a valid MemberID, FirstName, LastName and DateOfBirth. Even though the data may not change, all four values should be in the parameter list.
If the UPDATE command is not successful, an error should be returned to the client.
- FIND allows a client program to get the information of a specific MemberID. The server should return all four data fields.
If the FIND command is not successful, an error should be returned to the client.
- Write a client program that can be run multiple times concurrently from one or more computers. The purpose of this program is to randomly create the data that will be written to the database and to demonstrate that you can handle multiple requests simultaneously.
- Write a client program that can query the database (use the FIND command) and will allow you to update a specific record.
Hand in:
Method 1 Submission:
- The Server command definitions/protocol document
- All source code
- Installation and usage instructions
- Document stating any problems or deficiencies (bug list) in the submitted program.
Method 2 Submission:
- All source codes
- Usage instructions
Method 3 Submission:
- All source codes
- Usage instructions
Please discuss if you are still unclear about the requirements by dropping an email. I will be available for discussion on our class day that is Tuesday September 22,2020 after our regular class for some time.
Reviews
There are no reviews yet.