PROG2111关系数据库

【PROG2111关系数据库】Relational Databases – PROG2111 Assignment #1
Maximum group size: 2
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 client‐server 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 programsthat try to accessthe 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:

  1. The database file consists of records with the following fields:
    A. MemberID (as an integer)
    B. FirstName (as a variable length string)
    C. LastName (as a variable length string)
    D. DateOfBirth (as a Date format supported by your OS)
  2. 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:
    A. 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 1‐40,000 would
    be valid.
    If the INSERT command is not successful, an error should be returned to the client.
    B. 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.
    C. 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.
  3. Write a client program that can query the database allowing you to use INSERT, UPDATE and
    FIND commands
    Hand in:
    Method 1 Submission:
  4. The Server command definitions/protocol document
  5. All source code
  6. Installation and usage instructions
  7. Document stating any problems or deficiencies (bug list) in the submitted program.
    Method 2 Submission:
  8. All source codes
  9. Usage instructions
    Method 3 Submission:
  10. All source codes
  11. 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.

    推荐阅读