Prepared for: Prepared by:

Cynthia Xin Zhang, Instructor ITCS 3160 - 001 Group 4 Darren Adams Sergey Begun Andrew Fail Shawn Haigler Franklin Lee April 18, 2007

ii ABSTRACT This report describes our group's implementation of a library management system. We used the Entity-Relationship model to design a database that will store and organize the library's data. We have created the database using SQL and populated it with some sample data. The system can keep track of library cards, customers, librarians, library locations, books, videos, and the relationships between them. Using Java Server Pages, servlets, and JDBC, we have created an Internet-based graphical user interface that allows customers and librarians to access the system remotely.

.........iii LIST OF ILLUSTRATIONS Figures Figure 1: ER Diagram........... 6 ............................................................ 4 Tables Table 1: Relational Database Schema...........................

.......................................................................................... 20 A.... B......................................................... 1 Requirement Analysis......................................................... 8 Physical Database Design............ iii Introduction............................................................. 6 Normalization................ 19 Appendices............................................................................... 2 ER Design....... ii List of Illustrations............................... 21 ................................................................................................................................................................................ 9 GUI Design............................. ER Diagram............................ 13 Conclusions and Future Work............................................................................................. 20 Website Layout......TABLE OF CONTENTS Abstract..................................................................................................... 4 Relational Database Design.........

1 INTRODUCTION This report will provide a detailed account of the processes our group used to design and implement a database that can be used to manage a library system. . Each subsection of the report corresponds to an important feature of database design.

The library must keep track of the status of each media item: its location. They will then be assigned a unique user name and ID number. and each branch will have an address and a phone number associated with it. They receive a paycheck. its workers. therefore. each media item will have a unique ID number. and date of birth when signing up for a library card. The library will have branches in various physical locations. Each library card will have its own fines. phone number. the same information that is collected about customers should be collected about employees. and the media stored in those locations. address. or both) title . plus a temporary password that will have to be changed. a library branch will store media and have employees. Additionally. video. Customers will provide their name. the physical locations of its branches. and movies by their title and year. but they can also have library cards. Employees will work at a specific branch of the library. status. and cost for losses and late returns. In order to allow multiple copies of the same book or video. Books will be identified by their ISBN. Checkout operations will require a library card. Branches will be identified by name. Functions for customers: ● ● Log in Search for media based on one or more of the following criteria: ○ ○ type (book.2 REQUIREMENT ANALYSIS A library database needs to store information pertaining to its users (or customers). but active fines on any of a customer's cards will prevent the customer from using the library's services. descriptive attributes. We have decided to limit the media to two types: books and videos. as will requests to put media on hold.

3 ○ ○ ● author or director year Card number(s) Fines Media currently checked out Media on hold Access their own account information: ○ ○ ○ ○ ● ● ● Put media on hold Pay fines for lost or late items Update personal information: ○ ○ ○ Phone numbers Addresses Passwords Functions for librarians are the same as the functions for customers plus the following: ● ● ● ● ● ● ● ● ● Add customers Add library cards and assign them to customers Check out media Manage and transfer media that is currently on hold Handle returns Modify customers' fines Add media to the database Remove media from the database Receive payments from customers and update the customers' fines View all customer information except passwords ● .

The Status entity has also been separated from Media in order to save space. a good design will minimize redundancy and attempt to store all the required information in as small a space as possible. After some consideration.4 ER DESIGN It is clear that the physical objects from the previous section – the customers. Notice that the information about books and videos has been separated from the Media entity. The . we have decided on the following design: Figure 1: ER Diagram Refer to Appendix A for a zoomed-in view. employees. media. and library branches – correspond to entities in the Entity-Relationship model. cards. and so on – correspond to relationships. This allows the database to store multiple copies of the same item without redundancy. and the operations to be done on those entities – holds. However. checkouts.

The librarians will have access to the same features as customers. such as checking media in and out and updating customers' fines. . it can be used to create a waiting list of interested customers. so each Librarian also has a customer associated with it. but they will also perform administrative functions. The Librarian entity is functionally an extension to Customer.5 Hold relationship stores the entry's place in line (denoted by "queue").

we took advantage of the special relationships found in our design. and were able to condense the information to 13 tables.6 RELATIONAL DATABASE DESIGN After coming up with an Entity-Relationship model to describe the library system. This new design is a database that combines some entities and relationships into common tables. Table 1: Relational Database Schema Status Media Book code media_id ISBN ↓ BookMedia media_id Customer Card Checkout Location Hold Stored_In Librarian Video ID num ↓ media_id name ↓ media_id ↓ media_id eid title ↓ VideoMedia media_id desctiption ↓ code title ↓ ISBN name fines ↓ num addr ↓ num ↓ name ↓ ID year ↓ title Pay ↓ name since since phone ↓ name until queue until addr ↓ ID DOB phone username password author year dewey price director rating price ↓ year .

7 Note: the arrows in the diagram represent foreign key constraints. .

It would be redundant to store both codes and descriptions in the Media object.) .) In order to decompose the relationships into this form. and each status code has an associated description.8 NORMALIZATION As stated earlier. The Card entity. the tables in this database are in the Third Normal Form (3 NF. so we created a dedicated Status table with the code as the primary key. The other tables were designed with optimization in mind. was separated from the Customer entity to avoid a functional dependency (since the "num" attribute of the Card entity determines the "fines" attribute. we had to split Status table from the Media table. Each Media object has a status code. for instance.

description CHAR(30). 'mlprieto'. Prieto'. CREATE TABLE VideoMedia( media_id INTEGER. FOREIGN KEY (ISBN) REFERENCES Book). addr. PRIMARY KEY (eid). DOB CHAR(10). PRIMARY KEY (media_id). FL 33602'. until CHAR(10). 'Jason L. CREATE TABLE Card( num INTEGER. FOREIGN KEY (ID) REFERENCES Customer ON DELETE CASCADE. ID INTEGER NOT NULL. ID INTEGER. name CHAR(64). queue INTEGER. username. INSERT INTO Customer(ID. num). 'jlgray'. '970-273-9237'. Pay REAL. FOREIGN KEY (media_id) REFERENCES Media ). addr. name char(64). FOREIGN KEY (media_id) REFERENCES Media. CREATE TABLE Video( title CHAR(128). '11/20/1961'. since CHAR(10). addr CHAR(256). name. PRIMARY KEY (title. PRIMARY KEY (media_id. phone. we ran the following script in UNCC's Oracle database: CREATE TABLE Status ( code INTEGER. UNIQUE (username) ). PRIMARY KEY (code) ). phone. PRIMARY KEY (num). FOREIGN KEY (media_id) REFERENCES Media ON DELETE CASCADE. In order to turn the relational design into a database. username. year INTEGER. PRIMARY KEY (ISBN) ). '2087 Timberbrook Lane. '09/09/1958'. DOB. PRIMARY KEY (ID). num INTEGER. '813-487-4873'. phone CHAR(30). password CHAR(32). CREATE TABLE Location( name CHAR(64). username CHAR(16). DOB. DOB. PRIMARY KEY (media_id). year) ). FOREIGN KEY (ID) REFERENCES Customer ). author CHAR(64). rating REAL. CREATE TABLE Customer( ID INTEGER. 'password1'). code INTEGER. price REAL. name CHAR(64). Gypsum. fines REAL. Loc_name CHAR(64) NOT NULL. username. PRIMARY KEY (media_id). CREATE TABLE Book(ISBNCHAR(14). CREATE TABLE Librarian( eid INTEGER. name. FOREIGN KEY (num) REFERENCES Card ). CREATE TABLE Hold( media_id INTEGER. CO 81637'. phone. ISBN CHAR(14). name. FOREIGN KEY (title.9 PHYSICAL DATABASE DESIGN The next step was to create the physical database and input some sample data. CREATE TABLE BookMedia( media_id INTEGER. INSERT INTO Customer(ID. dewey INTEGER. phone CHAR(30). Tampa. password) VALUES (60201. title CHAR(128). addr CHAR(256). until CHAR(10). PRIMARY KEY (name) ). addr. title CHAR(128). '1465 Marion Drive. FOREIGN KEY (name) REFERENCES Location ). The next script populated the database with sample data: INSERT INTO Customer(ID. password) VALUES (89682. CREATE TABLE Checkout( media_id INTEGER. year INTEGER. PRIMARY KEY (media_id). num INTEGER. price REAL. FOREIGN KEY (Loc_name) REFERENCES Location(name) ). password) VALUES . FOREIGN KEY (media_id) REFERENCES Media. CREATE TABLE Media( media_id INTEGER. 'password2'). director CHAR(64). CREATE TABLE Stored_In( media_id INTEGER. Gray'. PRIMARY KEY (media_id). FOREIGN KEY (num) REFERENCES Card. 'Mary L. year INTEGER. FOREIGN KEY (name) REFERENCES Location. FOREIGN KEY (media_id) REFERENCES Media. year) REFERENCES Video ). FOREIGN KEY (code) REFERENCES Status ).

fines.0. fines. 3). media_id. Garfield Heights. name. 'sjschilling'. '847-221-4986'. INSERT INTO Location(name. media_id. phone. 1). 'David Bain'. username. addr. phone. fines. 2323953. '07/02/1954'.0. 0. addr. 'jmbyler'. Byler'. '08/22/1973'. '08/10/1947'. Travelers Rest.0. 'rpalber'. (9982. Card(num. 'Steven Jensen'. '03/04/1984'. 'password4').0. 'On Hold'). '847-953-8130'). INTO Customer(ID. Dallas. Alber'. password) VALUES (79916. Card(num. Card(num. '2888 Oak Avenue. 'Sally J. (2150. 0. 'Checked Out'). INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO Location(name. (5748. fines. TN 37766'. Bensenville. media_id. 'In Transit'). 'password8'). 1). VA 20705'. (5271. fines. 2645634.0. DOB. INTO Customer(ID. Card(num. 'password7'). Schilling'. name. fines. TX 75208'. Card(num. 60201). password) VALUES (57054. Card(num. phone. DOB. '3022 Lords Way. username. '216-789-6442'. TN 38363'. phone) VALUES ('Texas Branch'. 64937). '731-845-0077'. 5532681. 10. INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO Status(code. '93 Sunny Glen Ln. DOB. DOB. OH 44125'. fines. 'Warren V. addr. '423-592-8630'. 58359).0. addr. name. INTO Customer(ID. phone. IL 60016'. 2). media_id. fines. 88564). 0. media_id. DOB. 'sjensen'. '225-346-0068'). password) VALUES (58359. (4589. 'password10'). 0.0. phone) VALUES ('Illinois Branch'. LA 70802'. 49312). '864-610-9558'. '1894 Wines Lane. '03/07/1945'. Card(num. ID) ID) ID) ID) ID) ID) ID) ID) ID) ID) ID) VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES ( ( ( ( ( ( ( ( ( ( ( 5767052. 2197620. 0. 'password9'). addr.0. VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES (8733. TX 77002'. addr. name. Card(num. Woodson'. 1). 9780749. phone. (4. media_id.0. 'Kevin Spruell'. 'Ruth P. INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO Card(num. 4387969. 60201). Beltsville. (2. (3. 'wvwoodson'. 'password3'). fines. 'password6'). (2220. 1521412. 'rhurst'. Parsons. 1). La Follette. 1). INTO Customer(ID. fines. '4356 Pooh Bear Lane. Status(code. '12/14/1968'. addr. 4444172. 'dbain'. '279 Raver Croft Drive. name. '703-953-1216'.0. 1). INTO Customer(ID. username. password) VALUES (93265. 0. '3842 Willow Oaks Lane. 0. name. Lafayette. 'John M. '2063 Washburn Street. addr.0. username. 0. addr. Baton Rouge. 93265). media_id. 3688632. '02/18/1976'. 1). LA 70507'. DOB. Card(num. media_id. password) VALUES (49312. '974 Bingamon Branch Rd. '1124 Broadcast Drive. 3920486. 'password5'). DOB. 0. password) VALUES (88564. '337-316-3161'. fines. phone) VALUES ('Louisiana Branch'. INTO Customer(ID. 31430). (4188. '11/27/1954'. 0. media_id. media_id. 79916). Houston. 57054). phone. INTO Customer(ID. Media( Media( Media( Media( Media( Media( Media( Media( Media( Media( description) description) description) description) code) code) code) code) code) code) code) code) code) code) VALUES VALUES VALUES VALUES (1. username. Card(num. phone. password) VALUES (31430. (7757. (3725. Status(code. username. 89682). 1). SC 29690'. username. '832-366-9035'.10 (64937. IL 60106'. name. INSERT INTO Location(name. Status(code. Des Plaines. '214-948-7102'). 'kspruell'. . 'Available'). '4832 Deercove Drive. 'Roger Hurst'. addr.

0). '978-1596912366'). 'Steven Spielberg'. (8388. title. price) VALUES ('978-0743289412'.0). title. INSERT INTO Video(title.0). price) VALUES ('Terminator 2: Judgment Day'. 20. '978-0743289412'). 10. dewey. 2006. (9982. 10. num.3. 10. 'Ishmael Beah'. 1986. 10. '978-0385340229').0). 902. INSERT INTO Book(ISBN. 20. title. year. 2006. rating. 'Terminator 2: Judgment Day'. 'Eric Blehm'. author. 20. media_id. '978-0316740401'). 2006. INSERT INTO Video(title.11 INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO Media( Media( Media( Media( Media( media_id. INSERT INTO Book(ISBN. dewey. until) VALUES (2220. BookMedia(media_id. year. 10.7. 'Lisey''s Story'. 813. 4). price) VALUES ('978-0374105235'. author. price) VALUES ('978-1596912366'. ISBN) ISBN) ISBN) ISBN) ISBN) ISBN) ISBN) ISBN) ISBN) ISBN) VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES VALUES (8733. INSERT INTO Video(title. 'John McTiernan'.3. dewey. 10. (4589. 8. INSERT INTO Checkout(media_id. 8. rating. year. 'Danielle Steel'. dewey.0). 916. 'Kate Atkinson'. year. BookMedia(media_id. INSERT INTO Book(ISBN. year. 'Wendy Blackburn'. 813. (1716. 2006. 1991. director. author. 813. media_id. price) VALUES ('978-0156031561'. title. INSERT INTO Video(title. 1). 2007. author. INSERT INTO Book(ISBN. (2150. 'Beachglass'. dewey. INSERT INTO Book(ISBN. 'Stephen King'.0). year. BookMedia(media_id. (8714. '978-0316013949').0). price) VALUES ('978-0060583002'. since. author. year. 'Restless: A Novel'. price) VALUES ('978-0312351588'. rating. 20. 1).0). director. 'James Cameron'. INSERT INTO VideoMedia(media_id. media_id. year. (5725. title. (5748. 10.0). 1991).0).0).'. INSERT INTO Book(ISBN.0. title. rating. price) VALUES ('978-0316013949'. 'Case Histories: A Novel'. '978-0312351588'). dewey. '978-0060583002'). INSERT INTO Book(ISBN. 'Sisters'. year. INSERT INTO Book(ISBN.0). year. BookMedia(media_id. year. 2006. author. author. INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO BookMedia(media_id. 910. 8. 2006. 'James Cameron'. BookMedia(media_id. title. price) VALUES ('Aliens'. (3725. 2007. '02/15/2007'. price) VALUES ('Die Hard'. (4188. author. author. 'Step on a Crack'. year) VALUES ( 1734. 9780749. 1981. (7757. price) VALUES ('Raiders of the Lost Ark'. price) VALUES ('978-0316740401'. director. year. 2006. 1). title. 'The Places In Between'. 1). BookMedia(media_id. code) code) code) code) code) VALUES VALUES VALUES VALUES VALUES (1734. 'Long Way Gone: Memoirs of a Boy Soldier'. title. 'William Boyd'. price) VALUES ('978-0385340229'. '03/15/2007'). 'Rory Stewart'. '978-0374105235'). et al. 813.0). BookMedia(media_id. . BookMedia(media_id. dewey. 10. (2220. 1988. title. 8. year. '978-0156031561'). dewey. 10. 813. media_id. dewey. (5271. 'James Patterson. '978-1596912366'). INSERT INTO Book(ISBN. 813. BookMedia(media_id. 'The Last Season'. director.

'Louisiana Branch'). 'Illinois Branch'). Stored_In(media_id. 'Texas Branch').00. Stored_In(media_id. VALUES(5271. 30000. 'Texas Branch'). Stored_In(media_id.12 INSERT INTO VideoMedia(media_id. 64937. INSERT INTO Hold(media_id. Loc_name) Values (6190164. 'Raiders of the Lost Ark'. 'Texas Branch'. Stored_In(media_id.00. year) VALUES ( 5725. 3 Locations and 3 Employees.00. Stored_In(media_id. 'Texas Branch'). until. 30000. ID. '02/20/2008'. VALUES(8388. 1986). INSERT INTO Librarian(eid. queue) VALUES (1716. Stored_In(media_id. title. Stored_In(media_id. Stored_In(media_id. pay. Stored_In(media_id. 'Louisiana Branch'). ID. 'Aliens'. VALUES(4589. VALUES(2150. VALUES(7757. 'Texas Branch'). 'Texas Branch'). 'Louisiana Branch'). title. 'Aliens'. VALUES(5748. VALUES(4188. ID. name. Stored_In(media_id. 'Texas Branch'). INSERT INTO VideoMedia(media_id. VALUES(1734. INSERT INTO VideoMedia(media_id. title. VALUES(5725. and 15 media items. A Hold relationship and a Checkout relationship were also created. 1986). 1981). VALUES(3725. Loc_name) Values (2591051. title. 'Illinois Branch'). INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INSERT INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO INTO Stored_In(media_id. 'Illinois Branch'). 'Louisiana Branch'). 4444172. num. year) VALUES ( 8388. INSERT INTO Librarian(eid. VALUES(9982. . name) name) name) name) name) name) name) name) name) name) name) name) name) name) VALUES(8733. 88564. 'Die Hard'. Stored_In(media_id. INSERT INTO Librarian(eid. year) VALUES ( 8714. 1988). Loc_name) Values (1810386. VALUES(1716. 30000. VALUES(8714. 'Illinois Branch'). Stored_In(media_id. 1). 'Louisiana Branch'). INSERT INTO VideoMedia(media_id. The database was created and filled with 10 Customers. pay. 'Illinois Branch'). 11 Cards. Stored_In(media_id. 58359. pay. year) VALUES ( 1716. 'Illinois Branch').

Note that the terms labeled <user input> are to be filled in by the application after it receives input from the user and validates it. Finally. by all three fields. some searches (i. this architecture makes extending the functionality of our system easier. By using JDBC we could separate the application logic from the DBMS as well as from clients.e. we will not need to change the database. users will have the option to search for a book by title only.ID. we settled on using the JDBC API. Before beginning Java development. For simplicity's sake. by year only. we needed to define a set of queries that our application would use to communicate with the Oracle database. however. The queries are presented below.addr. 'Customer') AS role . nvl((SELECT 'Librarian' FROM Librarian L WHERE L. The availability of JavaServer Pages on UNCC's servers was an important factor.13 GUI DESIGN The first step in designing the GUI was to choose a means of accessing the database. by author only. Note also that complex procedures that require several steps and modify more than one table – such as operations to check out media or put media on hold .name. C. C. as it allowed us to develop our application using a three-tier architecture. determined at run-time. but not their possible combinations. When adding a new feature or improving an existing one.DOB.ID).will combine several queries into a single /* Functions available to customers \* */ *\ /* User login and authentication */ SELECT C. eliminating the possibility of corrupting the database. or by any combination of two fields.ID = C.username. C. C. it will only be necessary to modify the Java portion of the code. the search queries listed below contain all possible search parameters. After evaluating various options. searches for Book or Video entries) may have a variable number of search parameters. In addition to simplifying operations on the database. C. For example.

ID AND VM. */ SELECT BM.14 FROM WHERE Customer C C. Media M WHERE S.password = <user input>. V. V. 0) + 1 ). Status S WHERE VM.code = 1) AS num_available FROM Video V WHERE FROM Stored_In SI WHERE SI.code = M. <user input>. queue) VALUES (<user input>. B. 'none') AS name FROM VideoMedia VM. /* Find the status of a given media item */ SELECT S.media_id = VM.title. /* Find all copies of a video (used for placing holds or viewing detailed information). nvl((SELECT SI.media_id = <user input>).code. Step 2: Update queue for this item */ UPDATE Hold .year = <user input> AND M. V.code AND M.year <= <user input> AND B. /* Book search for customers */ SELECT B. <user input>.media_id = <user input>.queue) FROM Hold H WHERE H.media_id = BM. (SELECT COUNT(*) FROM BookMedia BM WHERE BM.year <= <user input> AND V. 'none') AS name FROM BookMedia BM.description. B.username = <user input> AND C. Media M.rating >= <user input>.description.media_id = BM. nvl((SELECT MAX(H.media_id AND S. B.code = M.media_id = VM.year. until.director.media_id).year <= <user input> AND V.media_id. */ SELECT FROM Stored_In SI WHERE SI. /* Video search for customers */ SELECT V.ISBN = <user input> AND M. S. S. Step 1: Remove the entry from hold */ DELETE FROM Hold WHERE media_id = <user input> AND num = <user input> /* Cancel Hold.year. num. nvl((SELECT SI. Media M.description FROM Status S.title LIKE '%<user input>%' AND V.title = <user input> AND VM. /* Cancel Hold.year >= <user input>.ISBN AND BM. /* Create a new Hold */ INSERT INTO Hold(media_id.code.ISBN.media_id AND S.title LIKE '%<user input>%' AND B.ISBN = LIKE '%<user input>%' AND B.ID = V.code = M.code = 1) AS num_available FROM Book B WHERE B.rating (SELECT COUNT(*) FROM VideoMedia VM WHERE VM.media_id).media_id. Status S WHERE BM. /* Find all copies of a book (used for placing holds or viewing detailed information).title.director LIKE '%<user input>%' AND V. <user input>.

username. C. H.media_id. since.media_id = H.num = <user input> AND H.year. /* View media currently on hold for a given card */ SELECT B. num.ISBN = BM.num = <user input> AND CO.username. B.director. B.until. VideoMedia VM. Book B. C.media_id. V.director.addr. Stored_In SI WHERE H.fines) FROM Card CR WHERE CR.media_id.year.until FROM Checkout CO.media_id. BM.until. Book B WHERE CO.title AND VM.since.ISBN = BM.ID. nvl((SELECT 'Librarian' FROM Librarian L WHERE L. ).ID = <user input>.media_id = BM.title AND VM.15 SET WHERE queue = queue-1 media_id = <user input> AND queue > <user input>. VideoMedia VM.title = V.year.title = V.until FROM Checkout AND VM. V.year. /* Create an entry in Checkout */ INSERT INTO Checkout(media_id.year = V.media_id = H.media_id.fines FROM Card CR WHERE CR. <user input>. BookMedia BM. B.media_id AND B.ISBN AND SI.media_id = BM. *\ /* Find a customer */ SELECT C.DOB. C.title. Book B WHERE CO. Book B.num = <user input> AND CO. <user input>.num. <user input>. H. fines. CR. <user input>. <user input>). password) VALUES input>.title. CO. /* Functions needed to view information about a customer */ /* View the customer's card(s) */ SELECT CR. BM. <user input>.username = <user input> AND C.media_id = VM.ISBN UNION SELECT V. Stored_In SI WHERE H.title. AND B. /* Add new card and assign it to a customer */ INSERT INTO Card(num. /* Functions reserved for librarians \* /* Add INSERT (<user <user */ new customer */ INTO Customer(ID.media_id AND VM. SI. 'Customer') AS role FROM Customer C WHERE C. until) VALUES .year. /* View media checked out on a given card */ SELECT B. ID) VALUES ( <user input>. LIKE '%<user input>%' FROM Hold H. BookMedia BM.queue.ID = <user input>.num = <user input> AND H. input>. FROM Hold H. SI.ID). VM. phone. /* View the total amount of fines the customer has to pay */ SELECT SUM(CR.ID = C.year = V. V.queue.title.media_id UNION SELECT V.year AND SI. name.media_id = VM. CO. DOB. V. C. CO. addr. H. C.

<user input>. code) VALUES (<user input>.num = H. price) VALUES input>.16 (<user input>. <user input>. <user input>. <user input>). Card CR. year) VALUES (<user input>.num FROM Customer C.queue = 1 AND H. /* Remove the entry from Checkout */ DELETE FROM Checkout WHERE media_id = <user input>.num. title. <user input>. <user input>). /* Find the customer that should be notified about book arrival */ SELECT C. ISBN) VALUES (<user input>. <user input>. <user input>).media_id = <user input>. <user input>. 1).until FROM Hold H WHERE H. <user input>). <user input>. Hold H WHERE H. C. H. author.media_id = <user input> AND CR.queue = 1 AND H. H. name) VALUES (<user input>. /* Add a new VideoMedia object */ INSERT INTO VideoMedia(media_id. input>). CR. year. /* Change the status code of the media */ UPDATE Media SET code = <user input> WHERE media_id = <user input>. dewey. rating. /* Remove the entry for Stored_In */ DELETE FROM Stored_In WHERE media_id = <user input>. <user input>.num AND C. /* Find the next Hold entry for a given media */ SELECT H. <user input>. year. /* Add a new entry into the Video table */ INSERT INTO Video(title. /* Remove an entry from the VideoMedia table */ . /* Create the entry in Stored_In */ INSERT INTO Stored_In(media_id. price) VALUES (<user input>.name. <user input>).ID = CR. /* Add a new Media object */ INSERT INTO Media( media_id. /* Change the Stored_In entry to the target library branch */ UPDATE Stored_In SET name = <user input> WHERE media_id = <user input>. /* Add INSERT (<user <user a new entry into the Book table */ INTO Book( = <user input> AND H. <user input>. /* Remove an entry from the BookMedia table */ DELETE FROM BookMedia WHERE media_id = <user input>. /* Add a new BookMedia object */ INSERT INTO BookMedia( title.

and so on. cascading style sheets. They turned out to be simple and efficient enough not to require further optimization. view their account options. while librarians get an extended menu with administration-related links. The application performs queries on the database using servlets and JDBC. The menus change based on the user's role: customers have basic functions to search for media. Upon first entering the website. and a content box on the right. fines. /* Remove an entry from the Book table */ DELETE FROM Book WHERE ISBN = <user input>. /* Remove an entry from the Video table */ DELETE FROM Video WHERE title = <user input> AND year = <user input>. Our design is laid out in a fairly traditional manner – a navigation bar on the top. /* Remove an entry from the Media table */ DELETE FROM Media WHERE media_id = <user input>. /* Update the customer's fines */ UPDATE Card SET fines = <user input> WHERE num = <user input> After learning about the optimizers used by commercial database management systems. instead. the system accesses the database to find out whether the user is a librarian and builds the menu dynamically. Refer to Appendix B .17 DELETE FROM VideoMedia WHERE media_id = <user input>. we turned our attention to the GUI itself. a navigation box on the left side of the screen. When the user attempts to log in. we reviewed the above queries for efficiency. the system compares entered credentials with those stored in the database and presents the user with a menu. It should be noted that there is no special log in for librarians. We used a combination of tables. With the query design and optimization finished. the user is presented with a log-in prompt. and Java Server Pages to display the site's graphics.

or go to http://coit-servlet01.jsp to see the site in action.18 for a hard copy of the website .

. we used CSS and JSP to design an Internet-based GUI for remotely accessing the database. The database design supports more operations than are currently implemented by the GUI. the "hold" relationship can store a waiting list of customers who want to check out a particular media item. we would implement the above features. If we were to continue with this project. For example. Furthermore. Finally. and separate functions for customers and librarians. our group has designed and implemented a database for managing a library system with multiple locations. there is also the possibility of a customer having multiple library cards.19 CONCLUSIONS AND FUTURE WORK During this semester. we were able to keep the system's logic abstracted from both the end users and the DBMS by using JDBC to create a third-tier architecture. and also improve the account management and search features. the ability to store videos as well as books.

20 APPENDIX A: ER Diagram .

21 APPENDIX B: Website Layout .

Sign up to vote on this title
UsefulNot useful