Java Project
Java Project
MASTERS PROJECT
CPSC-597A
CPSC-597B
FALL - 2007
Guide:
Prof. Gonhsin Liu
FINAL REPORT
Submitted by
Srikiran Reddy Sudireddy
(ID#0701246)
1
ABSTRACT
The main objective of this project is to develop a GUI tool for the oracle
Installation. A GUI tool would be the best thing to implement as it is more user
can give, and most people who have used a computer have used a GUI in
some form or other, while most will not have used a command line interface.
Even if a Student has never used a computer before, they will be using a GUI
when using the computers at the organization, and so will have formed some
sort of mental model of how a GUI looks and works, and so will find it much
easier to adapt to a command line interface.
Currently the SQL plus tool can be accessed through one of two
Methods:
1. A terminal window on a UNIX/LINUX machine.
2. A telnet window on a PC within the organization.
2
Index
Chapter 1
1.Introduction
1.1 About Project 6
Chapter 2
2. Project Analysis
2.1 Project Requirements
2.1.1 Functional Requirements 10
2.1.2 Non functional Requirements 11
2.1.3 Software 12
2.2 Configuration Architecture
2.2.1 Two Tier Architecture 28
2.3 SDLC Approach 31
Chapter 3
3. Project Design
3.1 Data Flow Diagrams 34
3.2 Process Flow Diagrams 46
3.3 Data Model 47
3.3.1 Data Dictionary 48
3.4 Application Design
3.4.1 Modules 50
3.4.2 User Interface
3.4.2.1 Screens 54
Chapter 4
4. Testing
4.1 Black Box Testing 76
Chapter 5
Conclusion 78
Chapter 6
Bibilography 80
3
INTRODUCTION
4
ABOUT PROJECT
Introduction:
Purpose:
The purpose of this project is essentially to develop a tool that runs
within the domain, and can securely connect to the correct oracle database
depending on the user’s login and password.
Overview:
A GUI tool would be the best thing to implement as it is more user can
give, and most people who have used a computer have used a GUI in some
form or other ,while most will not have used a command line interface. Even if
a student has never used a computer before, they will be using a GUI when
using the computers at the organization, and so will have formed some sort of
mental model of how a GUI looks and works, and so will find it much easier to
adapt to a command line interface.
5
Objective:
The main objective of this project is to develop a GUI tool for the oracle
installation. A GUI tool would be the best thing to implement as it is more user
can give, and most people who have used a computer have used a GUI in
some form or other ,while most will not have used a command line interface.
Scope:
The scope this project is essentially to develop a tool that runs within
the domain, and can securely connect to the correct oracle database
depending on the user’s login and password.
Firstly, what is needed is a tool that has two main elements: An area
where the user can enter SQL code; and an area where the user can view the
result of the query they have entered. The user will also require a means of
connecting to the database depending on which language the GUI is
developed in. this connection will have to be secured and reliable, to ensure
that it does not connect to another database accidentally, and that all
commands sent via to tool are processed correctly and committed to the
database correctly.
The connection process will require a user name and Password form
the user, and will not allow a connection if the user cannot provide these, or
provides an incorrect user name and/ Password. The tool it self should be
develop in a language, which is portable. By this, we do not intend to carry it
with us every where we go , that it must be in a language, which can run on
more than one platform. This allows the organization and any other users
who implement the tool to run it without the worry of not being able to make
use of it if the platform on which they use it becomes unavailable it future.
Also, it means that it can be implemented on both the PC’s and the UNIX/
LINUX machines with in the organization.
6
The development of the tool also needs to consider the human-
computer interaction aspects that come with the development of any GUI. It’s
primary concern, and the one of the primary concerns of the project it self is to
make accessing the database more friendly user. This means developing a
tool which the user is comfortable user. A tool which the user can adapt to
with minimum training, and can learn to more quickly, using past experience
of other GUI’s or simply by trial and error.
Existed System:
SQL plus is a tool provide by oracle for use specifically with its
database installations it provides the user with full access to the database,
provided that the has the relevant permission and/or access rides for the task
they which the carryout. The problem with SQL plus, however, is that it is a
command line interface. This is not so much a problem for the staff at the
organization, but for some students, especially those with little or no
computing experience, it is a difficult task to learn to use it.
Proposed system:
The main objective of this projects is to develop GUI tool for the oracle
installation. A GUI tool would be the best thing to implement as it is more user
can give, and most people who have used a GUI in some form or other, while
most will not have used a command line interface. Even if a student has never
used a computer before , they will be using a GUI when using the computers
at the organization, and so will have formed some sort of mental model of how
a GUI looks and works, and so will find it much easier to adapt to command
line interface.
To understand the design principles of graphical user interfaces. To be
able to builds graphical user interfaces. It can execute the SQL queries
correctly and deliver the correct results. It is much easier to adapt to
command line interface. Students can easily access this GUI tool without any
computing experience.
7
PROJECT ANALYSIS
8
PROJECT REQUIREMENTS
Functional requirements:
9
Non Functional Requirements:
Software Specification
Database : ORACLE 9i
Hardware Specification:
RAM : 256MB
10
SOFTWARE:
JAVA
HISTORY OF JAVA:
Java language was developed by James Gosling and his team at sun
micro systems and released formally in 1995. Its former name is oak. Java
Development Kit 1.0 was released in 1996. To popularize java and is freely
available on Internet.
OVERVIEW OF JAVA:
The key that allows Java to solve both the security and the portability
problems just described is that the output of a Java compiler is not executable
code. Rather, it is Byte code. Byte code is a highly optimized set of
instructions designed to be executed by the Java run-time system, which is
called the Java Virtual Machine (JVM). That is, in its standard form, the JVM
is an interpreter for Byte code. This may come as a bit of a surprise.
11
Once the run-time package exists for a given system, any Java Program can
run on it. Remember, although the details of the JVM will differ from platform
FEATURES OF JAVA:
• Java is object-oriented language and supports encapsulation,
inheritance, polymorphism and dynamic binding, but does not
support multiple inheritances. Every thing in java is an object
except some primitive data types.
12
JAVA ENVIRONMENT:
Java environment includes a large no. Of tools, which are part of the
system known as java development kit (JDK) and hundreds of classes,
methods, and interfaces grouped into packages forms part of java standard
library (JSL).
JAVA ARCHITECTURE:
Then we compile the code, java compiler creates machine code (byte
code) for a hypothetical machine called java virtual machine (JVM). The JVM
will execute the byte code and overcomes the issue of portability. The code is
written and compile for one machine and interpreted all other machines. This
machine is called java virtual machine.
13
SWINGS
Describe Swing classes such as
1. JComponent
2. JFrame
3. JPanel
4. JApplet
5. JRootPane.JScrollPane.JViewPort
Swing components:
Frames
14
Panel
content pane makes the swing applets different from regular applets in
the following ways.
Components are added to the content pane of Swing applets, not
directly to the applet
The layout manager is set on a Swing applet’s content pane, not
directly on the applet
Default layout manager for Swing applet’s content pane is
BorderLayout whereas for regular applet’s, it is FlowLayout
Painting code is not directly put in a JApplet object.
15
Text Components
JTextField
JTextArea
JTextComponent
JEditorPane
JTextPane
JPasswordField
JTextField:
Text Area :
16
JTextArea(Document doc)
JTextArea(Document doc, String text, int rows, int cols)
JTextArea(int rows, cols)
JTextArea(String text)
JTextArea(String text, int rows, int cols)
Buttons
CheckBox:
Radio button:
By using the radiobutton any one option may be selected by the user .
By using the button group to create a group.
17
JRadioButton object can be created by using:
JRadioButton()
JRadioButton(Icon icon)
JRadioButton(Icon, boolean selected)
JRadioButton(String text)
JRadioButton(String text, boolean selected)
JRadioButton(String text, Icon icon)
JRadioButton(String text, Icon icon, boolean selected).
Combo Box:
Menus:
Menus show a list of items that indicate various tasks.
Select or click an option and another list or sub-menu opens up.
A Swing menu consists of a menubar, menuitems and menus.
Menubar is the root of all menus and menuitems.
18
Menu Hierarchy
Object
Componen
Container
JComponen
JAbstractButto JSeperato
JMenuBarJPopupMe
JMenuIte
JMenuBar:
JMenuBar is a component that can be added to a container through a
JFrame.
Consists of a number of JMenus with each JMenu represented as a
string within the JMenuBar
JMenuBar requires:
‘ SingleSelectionModel’ –
keeps track of the menu currently selected
‘Look and feel class’ –
Responsible for drawing the menu bar and responding to
events that occur in it.
JMenu:
19
JPopupMenu
Used to display the JMenu’s menu items
Look and feel.
Responsible for drawing the menu in the menubar and
for responding to all events that occur in it.
JCheckBoxMenuItem:
JRadioButtonMenuItem:
OVERVIEW OF JDBC:
20
• It is an API (Application Programming Interface) which consists of a set
of Java classes, interfaces and exceptions
• JDBC is a very popular data access standard.
• consists of a set of classes and interfaces written in the Java
programming language.
• provides a standard API for tool/database developers and makes it
possible to write database applications using a pure Java API.
• The standard defined by Sun Microsystems, allowing individual
providers to implement and extend the standard with their own JDBC
drivers.
• JDBC:
• establishes a connection with a database
• sends SQL statements
• processes the results.
• RDBMS (Relational Database Management Systems) or third-party
vendors develop drivers which adhere to the JDBC specification. Other
developers use these drivers to develop applications which access
those databases
• SUN prepares and maintains the JDBC specification. Since JDBC is
just a specification (suggestions for writing and using JDBC drivers),
third-party vendors develop JDBC drivers to this specification. JDBC
developers then use these drivers to access data sources.
21
schemas. These applications would access corporate database
servers on a local or wide area network. However, Java applications
could also access databases through the Internet.” The JDBC Guide
JDBC API:
• The JDBC API supports both two-tier and three-tier models for
database access.
• Two-tier model -- a Java applet or application interacts directly with
the database.
• Three-tier model -- introduces a middle-level server for execution of
business logic:
• the middle tier to maintain control over data access.
• the user can employ an easy-to-use higher-level API which is
translatedby the middle tier into the appropriate low-level calls.
Driver Manager
registers
22
♦ java.sql.DriverManager which handles loading of drivers and provides
support for creating new database connections
♦ java.sql.Connection which represents a connection to a particular
database
♦ java.sql.Statement which acts as a container for executing a SQL
statement on a given connection .
♦ java.sql.ResultSet which controls access to the row results of a given
Statement
• Statement
createStatement()
returns a new Statement object
PreparedStatement
prepareStatement(String)
returns a new PreparedStatement object
• It is the subclass of the statement class
• It compiles the SQL statement before execution and can also take
parameters.
Callable Statement
• This class extends the prepare statement class and is used for
executing database stored procedures from a java Program.
• These Statements are used to send SQL commands to the database
• These are created via the connection object.
23
JDBC Architecture:
The JDBC architecture is Divided in to 2 Parts
• JDBC API (java.sql).
• JDBC Driver Types .
Java Application
JDBC driver
24
Three types of drivers:
• JDBC Type 1 Driver (JDBC-ODBC Bridge plus ODBC Driver)
• JDBC Type 2 Driver (OCI Driver)
• JDBC Type 3 Driver (THIN driver)
Making a connection:
• The second step in establishing a connection is to have the appropriate
driver connect to the DBMS.
• The following line of code illustrates the general idea:
– String url = "jdbc:odbc:Fred";
– Connection con = DriverManager.getConnection(url, "myLogin",
"myPassword");
♦ At this point stmt exists, but it does not have an SQL statement to pass
on to the DBMS. We need to supply that to the method we use to
execute stmt . For example, in the following code fragment, we supply
executeUpdate with the SQL statement from the example above:
25
♦ stmt.executeUpdate("CREATE TABLE COFFEES " + "(COF_NAME
VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " + "SALES
INTEGER, TOTAL INTEGER)");
Oracle's SQL:
An Overview Structured Query Language (SQL) was introduced by
IBM as the language to interface with its prototype relational database. The
first commercially available SQL relational database management system was
management system, System R introducedin1979byOracle Corporation.
Today, SQL has become an industry standard , and Oracle Corporation
clearly leads the world in relational database Management system technology
Configuration Architecture
Two-tier Architecture:-
26
It also referred to as client-server architecture consists of a client
computer and a server computer, which interact through a well-defined
protocol. What part of the functionality the client implements, and what part is
left to the server, can vary. In the traditional client-server architecture, the
client implements just the graphical user interface, and the server implements
both the business logic and the data management; such clients are often
called thin clients and this architecture is illustrated in the figure.
APPLICATION CLIENT
LOGIC N
E
T
W ....
O
DBMS R
K
CLIENT
27
CLIENT
APPLICA
TION
N LOGIC
E
T
DBMS W
O ….
R
K CLIENT
APLLICA
TION
LOGIC
Over the last ten years, the large number of client server development
tools such Microsoft visual basic and Sybase power builder have been
developed. These tools permit rapid development of client-server software,
contributing to the success of the client-server model, especially the thin-client
version.
28
transferred between client and server. Fourth, thick-client systems do not
scale as the application accesses more and more database systems.
SDLC Approach
SDLC Approach (Waterfall Model):-
• Systems planning
• Systems analysis
• Systems design
• Systems implementation
• Systems operation and support
Systems Planning
Systems Analysis
The first step is requirements modeling where you define and describe
business process .During the next tasks, data modeling, process modeling
and object modeling to develop a logical model of business process the
system must support.
29
Systems Design
The purpose of system design is to create a blue print for the new
system that will satisfy all documented requirements .Whether a system is
being developed in house or purchased as a package.
Systems Implementation
30
PROJECT DESIGN
31
DATA FLOW DIAGRAMS
CONTEXT LEVEL:
database
A GUI
user Oracle
tool
LEVEL 1:
Valid Data
user SQL base
Login Executio
Ne Login
w
user process
Registration
LEVEL 2:
1.Create
databas Login
Database
SQL 2.DDL
Execution
3.DML
4.TCL
32
LEVEL 2.1.1:
User
Detail 2.1.1.2.
2.1.1.1.Get the Execute the
s
Username and command
password
Resul
t
login
Data
Base
LEVEL 2.1.2:
New user
2.1.2.3
2.1.2.1 2.1.2.2 Get the
Get user Register the Privilege
name user
Sql grant
statements privilege
2.1.2.4
login Execute the
Data Base command
33
LEVEL 2.2:
2.2.1.Create
table
Data
base
2.DDL 2.2.2.Alter
table
2.2.3.Truncate
table
2.2.4.Drop
table
LEVEL 2.2.1:
Create table:
Scheme
name
2.2.1.1.Get 2.2.1.2.Get
the the
Scheme name Object name
34
LEVEL 2.2.2:
Alter Table
Scheme
name
2.2.2.1.Get the 2.2.2.2.Get the
Scheme name Object name
Login Column
Sql alter details
Data base
statements
2.2.2.3.Get
2.2.2.4.Execute the
the alter command Column
LEVEL
2.2.3:
Truncate table
Scheme
name
2.2.3.1.Get the 2.2.3.2.Get the
Scheme name Object name
Object
name
Sql truncate
statements
Login
Data base
2.2.3.4.Execute the 2.2.3.3.Get the
truncate command Column details
result Column
details
35
LEVEL 2.2.4:
Drop
Table
Scheme
name
2.2.4.1.Get 2.2.4.2.Get
the the
Scheme name Object name
Objec
t
login
name
database
Sql drop
statements
2.2.4.3.Execute
the
drop command
result
LEVEL 2.3
DML STMTS
2.3.1.Select
table
login
databas
2.3.2.Insert e
table
3.DML
2.3.3.Update
table
2.3.4.Delete
table
36
LEVEL 2.3.1:
Select table
Scheme Object
name name
2.3.1.1.Get the 2.3.1.2.Get the 3.3.1.3.Get the
Scheme name Object name Column details
Sql select
login
statements
database
2.3.1.5.Execute
the select 2.3.1.4.Get the
commands conditions
result
conditions
LEVEL 2.4
User
database
2.4.2.Rollbac
4.TCL k
2.4.3.Define
Save
Point
2.4.4.Rollback
To save point
37
PROCESS FLOW DIAGRAMS
38
DATA MODEL
Introduction
39
Business requirements are normally captured by a semantic
logical data model. This is transformed into a physical data model instance
from which is generated a physical database.
Data Dictionary:-
40
Initially, data dictionaries are some times simply a collection of
data base columns and the definitions of what is the meaning and type of the
columns contain. Data dictionaries are more precise than glossaries (terms
and definitions) because they frequently have one or more representations of
how data is structured. Data dictionaries are usually separate from data
models since data models usually include complex relationships between data
elements.
LOGIN:-
Password Varchar2
41
APPLICATION DESIGN
Modules
Create database.
Data Definition Language(DDL).
Data Manipulation Language(DML).
Transaction Control Language(TCL).
Create Database:
In which user creates its own database .If it is a valid user can enter
into th home page, but if a new user must use the registration button in login
page to create its own database. By this we are providing security in which
each user has its own database and others cannot view it.
The language is used to define the data in the database is called data
definition language(DDL). In simple words DDL is used to create the
database, alter the database and delete the database. The result of
compilation of DDLstatements is a set of tables that is stored in a special file
called data dictionary.
The DDL is used by the conceptual schema to store or retrieve the
records to or from the database respectively , where these records describes
entities, attributes and relationships. The DDL is also known as data storage
and definition language used by the internal schema which describes how the
data is actually store.
42
DDL statements are used to define the structure of the data and include
statements like :
• CREATE :
It is used to create new tables.
• ALTER :
It is used to alter the structure of the data.
• DROP :
It is used to delete a table.
• TRUNCATE :
It is used to delete all the records from table
The operation of retrieving the data from the database using DML is
called as query. A query is a statement in the DML that requests the retrieval
of the data from database. The portion of DML used to pose query is known
as query language.
The query language contains commands to select and retrieve the data
from the database. Commands are also provided to insert, delete, select and
update the records.
43
• INSERT :
• UPDATE :
• DELETE :
It is used to delete the all the rows from the table as well as
specified rows from the table.
• SELECT:
Note: except group by field, all the other selected values should be
function of some column
44
Transaction Control Language:
• COMMIT :
• ROLLBACK :
• SAVE POINT :
45
USER INTERFACES
Screens:
If the user enters username and password then the user must click the submit
button and enters the home page but if a new user must click the registration
button and user goes to the create database page.In which user can create its
own database.
If the user enter correct username and password it enter into home page in
this he can click any one of the module .
46
Creation of a Database:
If a new user clicks registration button in the loginpage it enter into this page
in which user can create its own database, in which user gives username and
password to create new database.
47
Take Grant Permissions:
If the new user clicks submit button in create database and it enter into this
page,in which user get the grant permissions.
48
If new user get grant permissions it again enter login page to test whether
database created or not, if created it enter into home page,if not user must
again click registration button and goes to the create database page.
If the user is valid it enter into the home page and here user can click any of
the modules, firstly the user clicks the DDLStatements to create, alter,truncate
and to drop the table.
49
Welcome to DDLStatements:
when the user clicks the DDLStatement button in home page it enter into this
page in which user can choose any of the sub modules like create , alter ,
truncate and drop.
50
Welcome to Create table page:
In which user create the table by giving the table name , database name and
fields name, if user click the save button the table is saved in database
51
Welcome to alter table page:
If user selects alter command in the DDLStatements it enter into this page in
which user can add the fields by using save button and can modify the fields
using modify button.
52
Truncate table page:
In this user truncate the table ,if any fields to be removed this
command is used by giving the table name, database name and
fieldname.
53
Drop Table:
In this user can delete the whole table by using drop command , in
this we give the table name and database name in textfields and
click the delete button.
54
Welcome to DMLStatements:
If the user clicks the DMLStatements in home page the user enter
into this page in which can insert delete select and update the
values of the fields in the table
55
Insert table:
In this user insert the values to the table which is created by user in
DDL page
56
Delete Table:
57
Update Table:
In this page if user want to change any values in the table it can be
used.
58
Select Table:
In this user can select the values in the table by using this
command
59
Welcome to TCL Statements:
60
Commit :
61
Rollback:
If the user does not want to change any saved points then the user
can use this command
62
Save point:
63
TESTING
64
TESTING
By the use of this technique the missing functions for identified and
placed in their positions.
The errors in interfaces were identified and corrected.
This technique was also used to identify the initialization and
termination error and correct them.
Test case:
65
CONCLUSION
66
CONCLUSION
The main objective of this projects is to develop GUI tool for the oracle
installation. A GUI tool would be the best thing to implement as it is more user
can give, and most people who have used a GUI in some form or other, while
most will not have used a command line interface. Even if a student has never
used a computer before , they will be using a GUI when using the computers
at the organization, and so will have formed some sort of mental model of how
a GUI looks and works, and so will find it much easier to adapt to command
line interface.
Once developed the tool will have to be tested thoroughly for any bugs.
A through test of the tool should cover aspects as whether or not it connects
to the correct oracle database , whether or not it can execute SQL queries
correctly and deliver the correct results, and whether or not it can execute
database updates and connect them. It reduces the time complexity.
It easily for every user.
67
BIBILOGRAPHY
68
BIBILOGRAPHY
WEB SITES:
• www.java2s.com
• www.sun.java.com
• www.java.sun.com/doc/languageenvironment
• www.bpbpub.com
69