+ All Categories
Home > Documents > Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project...

Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project...

Date post: 16-Jun-2018
Category:
Upload: phungthien
View: 217 times
Download: 0 times
Share this document with a friend
14
Database Design for OCEAN Project ’DWH Instructor : Dr. Mike Frank Bongju Yu ([email protected] )
Transcript
Page 1: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

Database Design for OCEAN Project

'DWH�������������

Instructor : Dr. Mike Frank

Bongju Yu ([email protected])

Page 2: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

2

1. Project Domain

In this project, we try to develop a database system called the OCEAN (Open computation Exchange & Arbitration Network). The OCEAN is a general-purpose distributed computation network1[1]. Its purpose is to provide a market place where the demand of computation resource for intensive computation tasks meets the resource providers who have idle computation resources. The OCEAN will play a role as an arbitrator who matches the demand and supply of computation resources and get payments from the users of computation resources and pay the resource providers.

2. General Nature of the Application

2.1 Application Architecture

<Figure 1. OCEAN Architecture>

We will design the database part of the OCEAN project. Figure 1 shows the architecture of the OCEAN. The database part has three major modules, which are client, worker, and arbitrator. In scenario, a registered client submits a request to an arbitrator for computation power for a certain application, which has own requirements of hardware, software, maximum bid price, deadline and etc. The arbitrator that gets the request from a client finds a server who satisfies the requirements then makes a deal. After the arbitrator makes a deal, it

1[1] [Hyung 2000] Hyung K, Je, OCEAN Prototype for a General-Purpose Computation Exchange Market, 2000

……

Auctioneer Auctioneer …….

Buyer Buyer

Seller

Seller

Seller

Auctioneer Database

Seller

Seller

Seller …

Page 3: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

3

distributes the application to the available computer resources and gets the results from distributed computers and sends the results back to the original client.

2.2 Requirements of the data that must be stored in the database

The OCEAN database system is divided by three main parts, which are client, server, and arbitrator. The client division has also four sub information sections, which are contact, account, and application requirement. The server division should also have three information sections, which are contact, account and computer information. The arbitrator division basically manages the client and server information and bid history. The bid history is useful for matching the demand and supply.

Buyer Side

The client should register with contact and account information in order to use the OCEAN services.

The contact information has contact person’s email address, telephone number, address, name, company name, and login name with password.

Each client must his/her own account, which has credit card information, bank, preferred billing date, and balance.

A request from a client is consisted of requirements of hardware and software. It also comes with bid information.

Hardware requirement is type and number of CPU, memory amount, graphic card, and network bandwidth.

Software requirement is consisted of version of operating system, compiler, database, and tools.

Bid information is consisted of maximum bid price, due date and time.

Seller Side

Database for server side is composed of three sub information sections, which are account, contact, and computer resource information.

The contact information has contact person’s email address, telephone number, address, name, company name, and login name with password.

Each server side must his/her own account, which has credit card information, bank, preferred billing date, and balance.

Page 4: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

4

Computer information is composed of three sub sections, which are hardware, software, and operational information.

Hardware requirement is type and number of CPU, memory amount, graphic card, network topology, and network bandwidth.

Software requirement is consisted of version of operating system, compiler, database, and tools.

Operational information is composed of the owner id, available time period, minimum bid price, and balance.

Auctioneer Side

Arbitrators not only manage all the information of registered clients and servers but also have transaction history.

Transaction history is composed of client, server, date, execution time, and bid price.

2.3 Interactions between the application program and the database

We assume that the OCEAN project is implemented on C language. We use Sybase database management system. Especially, we will use the ODBC (Open Database Connectivity) technology to interact between the application program and the database. The ODBC API is the industry standard for database-independent connectivity with C programming language and a wide range of databases. It provides a call-level API for SQL-based database access that we commonly needs when working with Sybase. These include database connections, SQL statements, result sets, and meta-data.

Through this ODBC, we would have a uniform interface to our database. Once our program is connected with the database, we will provide the database with several SQL commands necessary for our applications, and we will get the corresponding results from the database through this connection.

3. Requirement Specification and EER Modeling

3.1 Information Requirements

3.1.1. Buyer Side

Page 5: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

5

(a) Contact

Domain Name Type Constraint Description Login id Char(10) Primary key Customer User ID

Password Char(10) 5 <= Password <= 20 Customer password

First Name Char(30) Not null Composite Domain

Last Name Char(30) Not null Composite Domain

Email address Char(40) Not null Customer E-mail Address

Telephone Char(20) Not null Telephone number

Company name Char(20) Not null Company Name

Street Char (50) Not null Composite Domain

City Char (20) Not null Composite Domain

State Char (10) Not null Composite Domain

Zip Char (10) 5 <= zip <= 10 Composite Domain

Credit card number Char(16) Card number = 16 Customer credit card number

Expiration date Date mm/dd/yy Expiration date of credit card

(b) Account History

Domain Name Type Constraint Description Total Balance Money Not null Balance of account

Transaction amount Money Not null Amount of a transaction payment

Transaction id Integer Not null Primary key

(c ) Computer – Hardware and Software

Domain Name Type Constraint Description CPU_type Char(20) Not null Type of CPU CPU_number Integer Not null Number of CPU Memory Integer Not null Unit of mega Network Bandwidth Integer Not null Unit of mega Graphic_card Char(20) Not null Type of graphic card OS Char(20) Not null Type of operating system Compilers Char(20) Not null Type of compilers Tools Char(20) Not null Type of tools

Page 6: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

6

(d) Application

Domain Name Type Constrain Description Application_type Char(20) Not null Simulation, scientific calculation, DB, etc. Expected_time Date Not null Expected duration Deadline Date Not null Expected deadline Bid_price Money Not null Bid price

3.1.2. Seller Side

(a) Contact Domain Name Type Constraint Description

Login id Char(10) Primary key Customer User ID

Password Char(10) 5 <= Password <= 20 Customer password

First Name Char(30) Not null Composite Domain

Last Name Char(30) Not null Composite Domain

Email address Char(40) Not null Customer E-mail Address

Telephone Char(20) Not null Telephone number

Company name Char(20) Not null Company Name

Street Char (50) Not null Composite Domain

City Char (20) Not null Composite Domain

State Char (10) Not null Composite Domain

Zip Char (10) 5 <= zip <= 10 Composite Domain

Credit card number Char(16) Card number = 16 Customer credit card number

Expiration date Date mm/dd/yy Expiration date of credit card

(b) Account History Domain Name Type Constraint Description

Total Balance Money Not null Balance of account

Transaction amount Money Not null Amount of a transaction payment

Transaction id Integer Not null Indicates transaction information

Page 7: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

7

(c ) Computer – Hardware and Software

Domain Name Type Constraint Description CPU_type Char(20) Not null Type of CPU CPU_number Integer Not null Number of CPU Memory Integer Not null Unit of mega Network Bandwidth Integer Not null Unit of mega Graphic_card Char(20) Not null Type of graphic card OS Char(20) Not null Type of operating system Compiler Char(20) Not null Type of compilers Tools Char(20) Not null Type of tools 3.1.3. Transaction History

Domain Name Type Constraint Description Transaction ID Integer Primary key Transaction ID Buyer_ID Integer Foreign key Buyer ID Seller_ID Integer Foreign key Seller ID Bid_price Money Not null Price of Bid Time Date Not null Time of transaction 3.1.4. Auctioneer

Domain Name Type Constraint Description Auctioneer id Integer Not null Auctioneer ID Date Date Not null Date of transaction IP Address Integer Not null IP Address of auctioneer Utilization Integer Percentage Utilization

Page 8: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

8

3.2 System Components and User Interface

This system requires several user interfaces. We use basic user interface technique the web browser.

• System component

Web browser

CGI – communication medium between user and system

HTML-Document format

• User interface : below screen made by html language using button, form, input dialog, etc.

Adding a new user screen – If the new user wants to join a member, the system displays proper screen.

3.3 ER Diagram

The diagram shows all entries and their relationships in our systems. The system has main three entities; Buyer, Seller and Auctioneer. Buyer and Seller have their own account history and h/w and s/w information. Auctioneer manages all transaction history and Buyer can create application.

Page 9: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

9

4. Relational Modeling

I underlined and made bold for primary key and italic for foreign key.

BUYER

b_id b_pwd b_name b_email b_phone b_company b_address b_cardnum b_exp_date

APPLICATION

app_id b_id app_type expect_time deadline bid_price

BUYER_SWHW

b_cpu_type b_cpu_num b_id b_mem b_net_band b_graphic b_os b_compiler b_tool

BUYER_ACCHIST

b_trans_id b_trans_amt b_total_bal b_id

SELLER

s_id s_pwd s_name s_email s_phone s_company s_address s_cardnum s_exp_date

SELLER_SWHW

s_cpu_type s_cpu_num s_id s_mem s_net_band s_graphic s_os s_compiler s_tool

SELLER_ACCHIST

s_trans_id s_trans_amt s_total_bal s_id

AUCTIONEER

a_id a_date a_util a_ip

TRANS_HISTORY

t_id s_id b_id a_id t_bid_price t_time

Page 10: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

10

5. The Schema Definition in SQL

Sybase provides a variety of graphical and command line utilities that enable clients to access data in a variety of ways. At the heart of these tools is Transact-SQL. Transact-SQL is an enhanced version of structured query language (SQL) which has been approved as the official relational query language standard by the American National Standards Institute (ANSI). Transact-SQL is compliant with many ANSI SQL standards and also provides important additional capabilities and functions. The following is a list of the most common and frequently used commands.

5.1 Create Table Command

These are several methods for creating a out file to turn in but I uses the interpreter shells isql that give you a way to record interactions with the Sybase command interpreter. I have a command file mocean.sql. We can use the standard Unix output redirection, such as :

isql –U bjyu –P “ocean_123” –i mocean.sql mocean.out

create table Buyer ( b_id varchar(10) not null, b_pwd varchar(10) not null, b_name varchar(30) not null, b_email varchar(20) not null, b_phone varchar(20) not null, b_company varchar(20) not null, b_address varchar(30) not null, b_cardnum varchar(16) not null, b_exp_date DATETIME not null, constraint pk_buyer primary key(b_id) ) go create table Application ( app_id varchar(20) not null, b_id varchar(10) not null, app_type varchar(20) not null, expect_time DATETIME not null, deadline DATETIME not null, bid_price MONEY not null, constraint pk_app primary key(app_id), constraint fk_app foreign key (b_id) references Buyer(b_id) ) go

Page 11: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

11

create table Buyer_swhw ( b_cpu_type varchar(20) not null, b_cpu_num integer not null, b_id varchar(10) not null, b_mem integer not null, b_net_band integer not null, b_graphic varchar(20) not null, b_os varchar(20) not null, b_compiler varchar(20) not null, b_tool varchar(20) not null, constraint pk_bsh primary key(b_cpu_type, b_cpu_num), constraint fk_bsh foreign key(b_id) references Buyer(b_id), constraint uq_bsh unique (b_id) ) go create table Buyer_acchist ( b_total_bal MONEY not null, b_trans_amt MONEY not null, b_trans_id integer not null, b_id varchar(10) not null, constraint pk_ba primary key(b_trans_id), constraint fk_ba foreign key(b_id) references Buyer(b_id) ) go create table Seller ( s_id varchar(10) not null, s_pwd varchar(10) not null, s_name varchar(30) not null, s_email varchar(20) not null, s_phone varchar(20) not null, s_company varchar(20) not null, s_address varchar(30) not null, s_cardnum varchar(16) not null, s_exp_date DATETIME not null, constraint pk_seller primary key(s_id) ) go create table Seller_swhw ( s_cpu_type varchar(20) not null, s_cpu_num integer not null, s_id varchar(10) not null, s_mem integer not null, s_net_band integer not null, s_graphic varchar(20) not null, s_os varchar(20) not null, s_compiler varchar(20) not null,

Page 12: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

12

s_tool varchar(20) not null,

constraint pk_ssh primary key(s_cpu_type, s_cpu_num), constraint fk_ssh foreign key(s_id) references Seller(s_id), constraint uq_ssh unique (s_id) ) go create table Seller_acchist ( s_total_bal MONEY not null, s_trans_amt MONEY not null, s_trans_id integer not null, s_id varchar(10) not null, constraint pk_sa primary key(s_trans_id), constraint fk_sa foreign key(s_id) references Seller(s_id) ) go create table Auctioneer ( a_id varchar(10) not null, a_date DATETIME not null, a_util integer, a_ip varchar(15) not null, constraint pk_auction primary key(a_id) ) go create table Trans_history ( t_id varchar(10) not null, s_id varchar(10) not null, b_id varchar(10) not null, a_id varchar(10) not null, t_bid_price MONEY not null, t_time DATETIME not null, primary key(t_id), constraint fk_trans_a foreign key (a_id) references Auctioneer(a_id), constraint fk_trans_b foreign key (b_id) references Buyer(b_id), constraint fk_trans_s foreign key (s_id) references Seller(s_id) ) go

Page 13: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

13

5.2 The Response of Sybase after creating To see which tables the owner bjyu has defined in the current database, use the system stored procedure sp_tables with input parameter @table_owner and value “bjyu”. We can use the standard Unix output redirection: 1> sp_tables @table_owner="bjyu" 2> go Using that, we can check there are tables that I made using create table command above.

6. Application Development I implemented registration page for ocean using HTML and CGI technique. I provide WWW pages for user interface. http://www.cise.ufl.edu/~bjyu/ocean/newcustomer.html

Page 14: Database Design for OCEAN Project - University of Florida · Database Design for OCEAN Project ’DWH˛ ˇ Instructor : Dr. Mike Frank Bongju Yu (bjyu@cise.ufl.edu) 2 1. ... b_cpu_type

14

This page displays the registration page for new customer. If there is new user who wants to register the system, we provide form that accepts user information to register. If the user submits information then the information is stored to the Buyer table. If the user input invalid value or leave the field empty, there would be appropriate error message. When user fills out the form completely and all input values are valid, the confirmation page would be shown with login name and password like below.

7. References

1. R.Elmasri and S.B. Navathe, Fundamentals of Database Systems, Addison Wesley, 2000.

2. Sybase, “Sybooks: Sybase SQL Server Transact – SQL User’s Guide” 3. Sybase, “Sybooks: SQL Server Reference Manual” 4. Sybase, “Sybooks: ASA ESQL Statement”


Recommended