ONLINE BOOKSTORE

advertisement
ONLINE BOOKSTORE
BY:
DATABASE
CSC 8490
Chaya Gaddamanugu
Ramaselvi Bala
Subhashini Rangu
Sheela Anand
SSSR.COM
Application overview:
• The business model for this project is an
"http://153.104.204.169:8080/books.html" that allows
customers to buy books from their homes through a web
site.
• The bookstore maintains a web site that allows people to
search through all the books currently available through
the store. The web site also provides a way for new
customers to sign up, as well as existing customers to view
their account status and order information.
.
Application Requirements:
• Product Description: Detailed descriptions of all its
books. This includes details such as title, author, price,
category, and other information that helps the bookstore
organize its collection, and helps the members search for a
book.
• Customer Information: Data on every customer member.
This includes information such as name, password,
address, and other details that enable the business
corporation to contact, bill, and deliver books to the
members.
Functionality of the web site
• Searching and Browsing: Visitors must be able to search
for books based on various attributes (e.g. title,
category/subject). They must also be able to browse
through the book collection without doing a specific
search.
• Transactions: Customers must be able to easily select
books to buy and check out. They also need to be able to
view their account status, find out which books they
currently have ordered and the order status information.
IMPLEMENTATION TOOLS
• ORACLE 9i
– new features in Oracle 9i are its support for XML, Java
and C++.
– Oracle9i continues to offer the best development
platform for Internet and traditional application
development. Key focus areas include:
• XML
• Enterprise Java Engine
• SQL and PL/SQL improvements
IMPLEMENTATION TOOLS
•
•
•
•
•
•
XML
XSL
JAVA
TOMCAT SERVER
HTML
SQL
DESIGN PHASES
• PHASE I
– Design and create a database that organizes and stores
data about the books, customers, and orders. This
includes creating tables to store data, and designing
rules for how these tables relate to each other so that the
data they store can be combined in meaningful ways.
Also includes conceptual design model, logical
mapping and physical implementation.
PHASE II
• Writing Java code that implements an interface to the
database.
• To establish a connection to the oracle 9i through java, the
listener should run. This can be run from lnsctrl.exe.
• The entire jar files used here need to have their classpaths
set.
• Developing java servlet, which takes in requests from the
user and process it accordingly.
• The result is displayed with proper format using xml and
xsl.
PHASE III
• Developing an html page for user login and books
browsing and searching.
PHASE I
BUSINESS RULES
• Each book must be one and only one among a textbook
or a general book or a magazine or a novel.
• Each textbook must be one and only one book.
• Each generalbook must be one and only one book.
• Each magazine must be one and only one book.
• Each novel must be one and only one book.
• Each textbook may be available as one and only one
newbook.
• Each textbook may be available as one and only one
oldbook.
• Each newbook must be associated with one and only
one textbook.
BUSINESS RULES
• Each oldbook must be associated with one and only one
textbook.
• Each customer may have one or more order-info.
• Each order-info must be associated with one and only
one customer.
• Each order-info must be a book order of one or more
books.
• Each book must be a book order of one or more orderinfos.
SPECIALIZATION
• The EER diagram is a result of specialization(top down
approach)
• The books database consists of different disjoint
categories, each having a common set of attributes
apart from its own set of attributes.
• This is the basis of specialization, resulting in
– BOOKS as super class entity, TEXTBOOKS, GENERALBOOKS,
MAGAZINES AND NOVELS its subclass entities.
• Created a relation for each superclass and subclass
with the Primary Key of the superclass as Primary Key
of each subclass.
AVOIDING NULL VALUES
TEXTBOOKS
ISBN
SUBJECT
TITLE
AUTHOR
CO_AUTH
PUBLICAT
EDITION
PAGES
BOOK_CD
DESC
DATE
NEWPRICE
NEWCOPIES
OLDPRICE
OLDCOPIES
TEXTBOOKS
ISBN
SUBJECT
TITLE
AUTHOR
CO_AUTH
PUBLICAT
EDITION
PAGES
BOOK_CD
DESC
DATE
NEWBOOKS
ISBN
NEWPRICE
NEWCOPIES
OLDBOOK
ISBN
OLDPRICE
OLDCOPIES
order_info
book_ord
er
info
n
m
m
Account
-order
info
books
1
cust_info
d
textbooks
novels
generalbooks
magazines
1
1
avail
able
avail
able
1
1
newbook
oldbook
EER DIAGRAM
MAPPING with CARDINALITY AND PARTICIPATION
PHASE II
DIRECTORY STRUCTURE
BIN
TOMCAT
textbooksstyle.xsl
magstyle.xsl
novelstyle.xsl
generalstyle.xsl
textbooks.xml
magazines.xml
novels.xml
BooksGen1.class
CLASSES
FinalGen1.class
LIB
All jar files
books.html
WEBAPPS
ROOT
records.html
PHASE II
• Servlet – captures user input from the browser – establishes connection
with the database – processes the request – generates an XML file –
applies an XSL stylesheet and outputs a HTML file.
• Establishing connection to the database
try {
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection(conStr, user,password);
}
• Use appropriate query to get data from the database.
– qryStr = "select * from textbooks t, newbook nb where t.isbn=nb.isbn";
– qryStr = "select * from magazines";
– if((topic.equals("Subject-Category")) &&
(category.equals("Textbooks"))){
qryStr = "select distinct * from textbooks t, newbook nb
where subject like '%" + keyword + "%' and t.isbn=nb.isbn";
keyword is what the customer enters.
PHASE II
• converts the data got from the database to an XML file, and save it
in the bin directory of the server.
• The generated XML file and the stylesheet for the XML file are
combined to form an HTML file.
• This HTML file is stored in the ROOT directory of the server.
• This file is the result of search.
A BRIEFING OF XML
• RESULT OF A NORMAL QUERY
TITLE
Oracle9i XML handbook
FNAME
LNAME
ISBN
PUBLISHER
Ben
Chang
123456
oracle press
XML
• Result in XML format
<book>
<title>Oracle9i XML handbook</title>
<author>
<fname>Ben</fname>
<lname>Chang</lname>
</author>
<isbn>123456</isbn>
<publisher>oracle press</publisher>
</book>
XSL STYLESHEETS
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head><title>Search Results</title></head>
<body bgcolor="#FFCDAE">
<table border="0" cellspacing="7" cellpadding="1">
<xsl:for-each select="ROWSET/ROW">
<tr><th>TITLE</th><td><xsl:value-of select=“TITLE" /></td></tr>
<tr><th>ISBN</th><td><xsl:value-of select=“ISBN" /></td></tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
FINAL HTML FILE
PHASE III
PHASE III
• Develop an html file, books.html, which will be the front end of the
web site.
• An html file for user authentication.
• And a final, system generated html file, that is the result of the search.
EXECUTION:
•
•
•
•
Load the database.
Start the database server (lsnrctl.exe).
Start the Tomcat web server.
Access the website
http://153.104.204.169:8080/books.html
from the browser.
• Begin search and transactions.
DEMO
EXTENSIONS:
• The project can be extended to a major B2B (Business To
Business) application. The system would store detailed information
about the products available, client information and the
administrative side details.
• What is a B2B Application?
– A B2B application is a web application that helps organizations
streamline processes, such as manufacturing and distribution, so
they can do business more efficiently with their resellers and
suppliers. It gives them a faster way to compare prices and
availability of goods and services they need to buy. And it's an
excellent way to show global customers what they have to offer.
XML AND CROSS-PLATFORM
COMPATABILITY
• Different enterprises can have their data in different
formats.
• Data exchange requires a high level of technological
agreement about data types, structures etc.
• Since XML is in text form and is self-describing, it
allows companies to integrate applications across the
internet.
SUMMARY AND LESSONS LEARNT
• The project helped us understand the functionality of a
web-based e-commerce application.
• We are now able to comprehend the role played by
newer technologies in improving such applications.
• We now understand how to integrate Oracle 9i, XML
and Java for the implementation of such an
application. We also understand the importance of a
web server.
• It was a pleasant experience doing the project!
Download