Вы находитесь на странице: 1из 19

1

Java Database Connectivity (JDBC)

The Java Database Connectivity is a set of Java classes that provide connectivity to
relational databases. We can use JDBC from our Java programs to access almost every SQL data
base like Oracle, Sybase, DB2, SQL Server, Access and FoxBASE etc.,JDBC drivers are
available from Symantec, Intersolv, IBM, JavaSoft and Borland/Visigenic etc.. With little effort
we can connect to a database.

Origins of JDBC:

JDBC is not a new query language. It is simply a Java object Interface (communication)
to SQL. Our applications use JDBC to forward SQL statements to a DBMS. We write SQL
statements in a Java program to perform database queries and updates. We can think of JDBC as
just a Java SQL wrapper. JDBC does not enhance or diminish the power of SQL. It’s simply a
mechanism for submitting SQL statements. JDBC can handle easily the manipulations like
connecting to a database, retrieving query results, committing or rolling back transactions.

JDBC is based on the X/Open SQL CLI (Call Level Interface), which is also the basis for
Microsoft’s ODBC interface. The CLI is not a new query language. It is simply a procedural
interface to SQL.

JDBC Drivers:
JDBC drivers are either direct or ODBC bridged direct driver sits on top of the DBMS’s
native interface .For example, Symantec provides direct drivers for Oracle 7.X using
ODBC.IBM also provides a native JDBC driver for its DB2products.direct means no translations
will be done between a JDBC program and the database. This will be faster and used in real-
time environment.

In contrast to direct drivers, bridged drivers are built on the top of existing ODBC drivers. JDBC
is created after ODBC.Consequently, there exists a translation between these the two protocols.
These types of bridge drivers are slow in communication. JavaSoft and Intersolv provide JDBC
to ODBC bridge drivers that make it easier to translate between JDBC and the various ODBC
drivers. As a result, the JDBC applications, we write are guaranteed to be portable across multi
vendor DBMS.That is, a JDBC program is both platform-independent and data-base-
independent.

All the classes and interfaces required for writing a JDBC program are included in
java.sql package. The java.sql is supplied with the core jdk software itself. JDBC drivers
provide implementation for these classes and interfaces of java.sql package. The other
responsibility of drivers is to maintain transaction reliability. The drivers must provide the
required synchronization protection.
2

The type 2 drivers are native API drivers. This means that the driver contains Java code that calls
native C or C++ methods provided by the individual database vendors that perform the database
access. Again, this solution requires software on the client system.

Type 3:

Type 3 drivers provide a client with a generic network API that is then translated into
database specific access at the server level. In other words, the JDBC driver on the client uses
sockets to call a middleware application on the server that translate the client request into an API
specified to the desired driver. As it turns out, this kind of driver is extremely flexible since it
requires no code installed on the client and a single driver can actually access to multiple
database.

Type 4:

Type 4 network protocol built into the database engine, type 4 talk directly to the
database using Java sockets. This is the most direct pure Java solution. In nearly every case, this
type of driver will come only from the database.

JDBC ARCHITECTURE:

JDBC is a portable SQL CLI written entirely in Java. It allows us to write DBMS-
independent Java code. DBMS- independent means we need not modify the JDBC
program for every different database. We have to change only the driver.

DATABASE MODELS:

JDBC and accessing the database through applets, and JDBC API via an intermediate
server resulted in a new type of database model, which is different from the client server model.
Depending on the number of intermediate servers through which the request should go it is
named single-tier, two-tier and multi-tier architecture.

Single Tier Architecture:

In a single tier architecture the server and the client are on and the same sense that a
client program that needs information (i.e. the client) and the source of information are a part of
the same environment. The best example for this is the dbase, where the source of information is
the dbase and even the client is also called dbase. This type of architecture is also present in Java,
in case flat files are used to store the data. The advantage with this is the simplicity and the
portability of the application developed.

Two –Tier Architecture:

In a two-tier architecture the database resides in one machine (server) and any number of
machines (Clients) in the network can access the data. In this type of architecture a database
manager takes control of the database and provides access to clients in a network. This software
3

bundle is also called as the server. Software in different machines, requesting for information is
called as the clients.

Three – Tier Architecture:

In the three tiers any number of servers, which in turn serve clients in a network, can
access architecture, the database that resides on one server. For example, you want to access the
database using applets, the applet running in some other machine, can send request only to the
server from which it is downloaded. For this reason we need to have an intermediate server
which will accept the requests from the applets and send them to the actual database server. This
intermediate server acts as a two-way communication channel. That is the information or data
from the database is passed on to the applet that is requesting it. This can be extended to make N-
tiers of servers, each server caring to a specific type of requests from clients. Sometimes the
middle tier may use some caching so that the response can be given faster.

JDBC components include

 JDBC Driver Manager

Function of the driver manager is to find out available drivers in the system and
connect the application to appropriate database whenever a connection is
requested. However to help the driver manager identifies different types of
drivers, each driver should be registered with the driver manager.

 JDBC Driver

Function of JDBC Drivers is to accept the SQL calls from the application and
convert them into native calls to the database. However, in this process, it may
take help of some other drivers or even servers, which depends on the type of
JDBC driver one is using. Also, it is possible that the total functionality of the
database server could be built into driver itself.

 JDBC-ODBC Bridge

Sun Soft provides a special JDBC Driver called JDBC-ODBC Bridge driver,
which can be used to connect to any existing database, that is ODBC compatible.

 `Application

application is a JSP program that needs the information to be modified in some


database or wants to retrieve the information.
4

Steps for connecting database through JDBC

 Load the Driver


 Establish the connection
 Create statement
 Execute statement.

JDBC URL Naming Conventions:

The following statements help a JDBC program to find its database:


Jdbc: <subprotocol>: domain name>

E.g.: jdbc: odbc: //www.yahoo.com/Employee

Registering Drivers:

The JDBC Driver Manager gets linked with the drivers in two ways:

 Using a system property: The driver manager class will look for jdbc.drivers property when
it initializes. The Driver Manager will automatically be linked with each named Driver class.
 Using an explicit method invocation: We can invoke the standard Java Class.forName
method to load a Driver class.

EG: Class.for Name (“sun.jdbc.odbc.JdbcOdbcDriver”)

JDBC Security:

JDBC must pay close attention to security issues. For example, a JDBC
driver must prevent an untrusted applet from accessing databases outside its local machine. Like
wise a driver that is downloaded as an applet can only be allowed to access it’s home database. If
we want to access databases on our systems, we can provide a certificate of authentication.

For regular Java applications, JDBC will happily load drivers from the local
CLASSPATH and allow the application free access to remote servers. The JDBC management
layer keeps track of which class loader provided which driver. It only uses drivers from the local
file system.

JDBC Transactions:

Like ODBC, JDBC also provides a transaction control model. All JDBC connections are
initially in autocommit mode. This means that JDBC implicitly issues a commit after each
statement it executes. To execute several statements within a single transaction, we must first
disable autocommit or rollback at the end of the transaction. The rollback or commit will also
implicitly start a new transaction
5

JDBC Stored Procedures:

SQL provides you with a means to combine multiple SQL statements into an
object that can be executed by a single command. Stored procedures are very similar to functions
and procedures of common programming languages. Stored programs enable you to combine
multiple SQL statements into common functional groups and they compile these statements into
procedures that are stored on the database.

Some of the main advantages of stored procedures include the capability to


combine multiple SQL statements and improved speed provided by compiled procedures. When
a procedure is created, the database determines the plan that it will use when executing the
procedure. When you call the procedure, because it has already stored the execution plan for the
problem.

Syntax for invoking a stored procedure in JDBC is

{Call procedure_name [(argument 1,argument 2,)]}

Advantages Of JDBC:

 Simplified Enterprise development


 Zero configuration for Network computers
 Full access to Meta Data
 No Installation
 Database Connection Identified by URL
 Included in the Java Platform
6

OPEN DATABASE CONNECTIVITY (ODBC)

ODBC is a standardized API (Application Programming Interface). It is a set of function


calls based on the SQL Access Group (SAG) function set for utilizing a SQL database system
(back-end system). The SAG set implements the basic functionality of Dynamic SQL. Embedded
SQL commands can translated to call ODBC. It is a programming interface from Microsoft that
provides a common language for Windows application to access databases on the networks.

With ODBC, Microsoft extended the basic SAG function set to include functions for
accessing the database catalog and for controlling and determining the capabilities of ODBC
drivers and their data sources (back-ends). They also have refined and flushed out the SAG
proposal. Microsoft supplies the ODBC Driver Manager for their operating systems (Windows,
Windows 95, and Windows NT). The ODBC Driver Manager coordinates access to ODBC
driver’s ad their associated data sources.

ODBC Architecture:

Application access ODBC functions through the ODBC Driver Manager which
dynamically links to the appropriate ODBC driver. ODBC drivers translate ODBC requests to
native format for a specific data source. The data source may be a complete RDBMS like Oracle
or SQL Server or it may be a simple file format, like Xbase.

Most ODBC drivers are tied to a single data source. Some, like FirstSQL, support
multiple data sources. The FirstSQL ODBC driver supports a FirstSQL, data source and a Xbase
data source.

ODBC Utilization:

ODBC provides a robust set of functions for access to a database. The interface is
complicated and takes time to learn to use well. It is often layered with a higher level interface
like Embedded SQL, C++ classes or Visual Basic controls. Another example of higher level
interfaces is Microsoft’s OLEDB.

Though often accessed through higher level objects, ODBC provides the appropriate
power to utilize database. It is the most widely supported portable database interface available.
7

HYPER TEXT MARKUP LANGUAGE (HTML)

HTML is an application of ISO standard 8879, SGML (Standard Generalized Markup


Language) but specialized to hypertext and adapted to the web. HTML is a markup language, i.e.
a language describing how documents ought to be formatted. This is enabled by a set of
elements, which make-up the document and inform the browser about the action to be taken
when a certain element is specified. It is a versatile language and can be used on any platform or
desktop.

The HTML tags model the appearance of a web page. Usage of graphics, fonts, different
colors, etc., can enhance the presentation of the document. It also has a provision for the creation
of hypertext links or hyperlinks to other documents or portions of the same document.

HTML supports two types of tags separating tags and the surrounding tags. Separating
tags are placed between the text elements to which they apply. E.g.: <BR> is used to insert a line
break. Surrounding tags consist.

HYPER LINKS:

Hyperlinks play a major role in HTML.Hyper link is a link, which when clicked takes
you to a screen where a more detailed information of that link will be available. Hyper link can
even move point to a remote document, which resides in a different directory. When the
movement of the mouse looks like a palm with a finger pointing upwards, it implies that it is a
hyperlink.

Its syntax is:


<A href = “filename”> text to be displayed</a>
Where <href> is the hypertext references browser has to take you soon after the user clicks on
the hyperlink. Text to be displayed is the text that appears on the screen as the hotspot.

FORMS:

Forms are the most interesting one’s that have been added in the recent times to
Web publishing. With the advent of these features, the Web changed from being a publishing
medium with the hyperlinks to fully interactive environment with the potential for being
something entirely new.
The following are the form elements, which are described one by one
<form method = “post” action=”do something”>
………………..

</form>
You can have multiple forms within a document, but these forms cannot be nested.
8

METHOD:

An attribute of the form tag, indicating the method with which the form input is given to
the script that processes the form. Possible values are Get, Post.

ACTION:

An attribute of the form tag, indicating the script to process the form input. Contains a
relatively path or URL to the script.

TYPE:

An attribute of the form tag indicating the script to process the form Input. Possible
values are submitted, reset text, radio and checkbox and hidden.

1. Submit creates a button, which resets default values of the form, if any.
2. Reset creates a button, which creates default values of the button.
3. Text creates a single-line text field.
4. Checkboxes creates a checkbox.
5. Hidden creates a form element that is not visible on the screen but has a name and value that
can be presented onto the script that process the form input.
9

SYSTEM SPECIFICATIONS

The software is developed to work in the Client/Server using a JAVA SERVER PAGES as
the front end and ORACLE-8 as back-end.

HARDWARE AND SOFTWARE SPECIFICATIONS:

The Software & Hardware specifications which are used for the development of
this project are listed below:

Software Specifications:

Server : Windows NT 4.0 Server


Client : Windows 95/98
Front-end development tool : Java Server Pages
Back end RDBMS : ORACLE 8

Hardware Specifications:

Server
Processor : Pentium III
Main Memory : 128 MB
Hard Disk : 20 GB

Client
Processor : Pentium II
Main Memory : 32 MB
Display Type : VBG 64K Color with resolution: 1024*768 pixels
Hard Disk : 4 GB
10

SYSTEM ENVIRONMENT:

OVER VIEW OF THE MS-WINDOWS OPERATING SYSTEM:

Windows was announced by Microsoft Corporation in November 1983 and was released
two years later in November 1985.Over the next two years Windows 1.01 followed by several
updates to support the international market and to provide drivers for drivers for additional
display devices and printers.

Windows 2.0 was released in November 1989.This version incorporated several changes
to the user interface to make it consistent with the forth-coming OS/2 presentation manager
(released in October 1988). The most significant of these changes involved the use the
overlapping windows rather than the title windows found in the earlier versions of widows.
Widows 2.0 also included enhancements to the keyboard and mouse interface particularly for
means of dialog boxes. Windows/386 released shortly after widows 2.0 used the virtual model of
386 microprocessors to Window and multi task many DOS programs that directly access
hardware.

Widows 3.0 was I a spectacular product announcement on May 22, 1990. The earlier
windows/286, windows/386 versions have been merged into protected mode operation of initials
up to 16 megabytes of memory. The Windows shell programs (Program Manager, File Manager,
Task Manager and Print Manager) have been completely revamped.

THE USER’S PERSPECTIVE:

Windows provides considerable advantages to both users and programmers over the
conventional Ms.Dos environment. The benefit to the users and the benefit to program
developers are quite similar because the job of programmers is to give users what they need and
want. Windows make this possible.

GUI CONCEPTS AND RATIONALE:

All graphical user interface make use of graphics on bit-mapped video display graphics
provides utilization of screen real estate, a visually rich environment for conveying information
and the possibility of a WYSIWYG (what you see is what you get) video display of graphics
and formatted text prepared or printed document. In earlier days the video displays was used
solely to echo the text that user typed using the keyboard. In the GUI the video itself becomes a
source of user input. The video display such as buttons and scrollbars. Using the keyboard (or
some directly pointing device as mouse), the user can be pushed, and scrollbars can be scrolled.

The interaction between the user and the program thus becomes more intimate. Rather
than the one-way cycle of information from the keyboard to the program to the video display, the
user directly interacts with the objects on the display.
11

THE CONSISTENT USER INTERFACE:

Users no longer expect to spend long periods of time learning how to use the computer or
mastering a new program. Windows help all window programs have the same fundamental look
and feel. The program occupies a window rectangular area on the screen. It is identified by a
caption bar. Most windows programs have both the keyboards as well as mouse interface.
From the programmer’s perspective, the consistent user interface results from using the
routines built into windows for construction menus and dialog boxes. All menus have the same
keyboard and mouse interface. Windows rather than application program handles the job.

THE MULTITASKING ADVANTAGE:

Although some people continue to question whether multitasking is really necessary on a


single user computer, users are definitely ready for the multitasking can benefit from it. The
popularity of MS-DOS RAM resident programs such as sidekick proves it. Although pop-ups are
not strictly speaking multitasking programs thy do allow fast context switching. This invoked
many of the concepts of multitasking.

Under Windows every program becomes in effect a RAM resident popup several window
programs can be displayed can be displayed and running at the same time. Each program
occupies a rectangular window on the screen. The user can move the Window around on the
screen change their size switch between different programs and transfer data from one program
to another, because this display looks something like desktop. Windows is something said to use
a desktop better for the display of multiply programs.

Windows is a graphical interface and windows programs can make full use of graphics
and formatted text on both video and printer. A graphical interface is not only more attractive in
appearance, but also imparts a high level of information to the user.

Programs written for windows do not directly access the hardware of the graphics display
such as screen and printer. Instead, Windows includes a graphics programming language. The
Graphical User Interface (GUI) that allows the easy display of graphics and formatted text.
Windows visualize display hardware. A program written for windows will run with any video
board or any printer for which a Windows device driver is available. The program does not need
to determine what type of device is attached to the system.

MEMORY MANAGEMENT:

An operating system cannot implement multitasking without doing something about


memory management. As knew programs are started up and old one’s terminated, memory can
be fragmented. The system must be able to consolidate free memory space. This requires the
system to move the blocks of code and data in memory space. Windows can over commit
memory, a program can contain mode code than can fit into memory at any one time. A user can
run several copies of a program, all these instances share the same code in memory. Programs
running in Windows can share routines located in other.
12

THE DEVICE MANAGEMENT GRAPHICS INTERFACE:

Windows is graphical user interface, and windows program can full use of graphics and
formatted text on both the video display and printer. A graphical interface is not only more
attractive in appearance, but it can also impart a high level of information to the user.

Programs written for Windows do not directly access the hardware of graphics display
device such as the screen printer. Instead, Windows includes a graphics programming language
that allows the program written for Windows to run with any video board or any printer for
which a window device driver is available.

DYNAMIC LINKING:

A Windows program interface to windows through a process called “Dynamic Linking”.


Like MS-DOS programs, Windows executables have the filename extensions, .EXE. Windows
programs use a .exe format called the new executable file format. Whenever a Windows program
calls a Windows function, the ‘C’ compiler generates assembly language code for a far call. A
table in the .EXE file identifies the function being called using a DDL name and either a name or
a number of functions in that library.

THE DATABASE MANAGEMENT SYSTEMS:

Database is a collection of related data. The Database Management System offers a


means for managing such a database in a consistent, efficient, effective and user-friendly manner.
A database can also be considered set of as objects. Data tables, Relations between the tables,
Constraints on the tables, Triggers, etc. are examples of objects. Every DBMS has its own ‘User
Interface’ for normal users to use the Database and an ‘Application Programming Interface
(API)’ for applications to use the Database. Virtually every application would in some way or the
other, interacts with a database. Different DBMS application would in some these things
different ways. A layer of software (usually ODBC) is used for different types of applications to
interact with multimedia of DBMS systems available in the market today.

Why database?

Why should a department choose to store its operational data in an integrated database?
The broad answer to this question is that a database system provides the department with
centralized control of its operational data, which is in a database system. There will be some
identifies person who has the central responsibilities of the operational data and he is known as
the Database Administrator (DBA).

The advantage that of having centralized control of the data are:


Redundancy can be reduced:

In non-database systems each application has its own application files. This can often
lead to considerable redundancy in stored data resultant wastage in storage in the storage space.
These private files can be integrated and the redundancy can be eliminated if the DBA has the
necessary overall control on the database system.
13

Inconsistency can be avoided:

Suppose that a given fact about the real works say an employee E100 works in
department D. he is presented by two distinct entities in the database and that no one is aware of
this duplication then there will be some occasion on which the two entries will not agree. At such
times the database is said to be inconsistent.

The database that is inconsistent is capable of providing conflict information. It is clear


that if a fact is represent by a single entity such an inconsistency cannot occur. Alternatively, if
the user does not see the redundancy, by ensuring any change made by either of the two entries is
automatically made to the other. This process is known as ‘Propagating Updates’.

Data can be shared:

It means not only that the existing applications can share the data in the database,
but also that new application can be developed to operate against that stored data.

Standards can be enforced:

With central control of the database, the DBA can ensure that all applicable
standards are followed in the representation of the data. The applicable standards may include
any or all the following: company, installation, department, industry, national and international
standards.

Security restrictions can be applied:

Having complete jurisdiction over the operational data, the DBA

1. Can ensure that the only means of access to the database is through the proper
channels and

2. Can define authorization checks to be carried out whenever access to sensitive


data is attempted.

Integrity can be maintained:

The problem of integrity is the problem of ensuring the data in the database is accurate.
Inconsistency between two entries representing the same fact is an example of lack of integrity,
which is of course due to redundancy. Even redundancy is removed, however the database may
still contain incorrect data.

Centralized control of the database helps in avoiding these situations so far as they can be
avoided, by permitting the DBA to define validation procedures to be carried out whenever
update operations is attempted.
14

Conflicting Requirements can be Balanced:

Knowing overall requirements of the enterprise as opposed to the requirements of any individual
user the DBA can structure the database system to provide an overall serve that is best for the department.

Types Of Data Models:

A data model is a collection of a conceptual tools for describing data, date relationships, data
semantics and data constraints. There are a number of different data models that have been proposed.
They are partitioned into different groups.

Object Based Logical Models:

 ER model
 Binary model
 semantic data model.

Record Based Logical Models:

 Relational model
 Networking model
 Hierarchical model.

Physical Data Model:

 Unifying data model


 Frame model

Advantages Of Relational Model Over Other Methods:

 Simplicity and ease of use


 Data independent from Application Programs
 Symmetry
 Flexibility
 Good theoretical foundation ( Mathematical theory of Sets and Relations )

An Approach towards designing a Relational Database System:

Relational database is a form of database specification upon the mathematical concept of a


relation. The mathematical nature of the concept is, however, not necessary to its appreciation and the
database may be regarded as composed of a number of rectangular tables, each expressing one relational
system is structured at the achieved by the combination of relations using relational operates.
15

Normalization: Normalization is carried out for four reasons:

 To structure the data so that at any pertinent relationship between activities can be
represented.
 To simplify the maintenance of the data through updates, insertions and deletions.
 To reduce the need to restructure or recognize data when new application requirements arise.

First Normal Form: A Relation is in 1NF if and only if all underlying domains contain scalar values
only.

Second Normal Form: A Relation is in 2NF if and only if it is in 1NF and every nonkey attribute is
irreducibly dependent on the primary key.

Third Normal Form: A Relation is in 3NF if and only if the nonkey attributes are
a) Mutually independent and
b) Irreducibly dependent on the primary key.

Boyce / Codd Normal Form (BCNF): A relation is said to be in BCNF if every determinant is a
candidate key. Relational in third normal form can also have anomalies. Relations in BCNF have no
anomalies regarding functional dependicies and this seems to have put the issue of modification
anomalies to rest. The fourth, fifth and domain/key normal forms were proposed to
overcome these anomalies.
16

THE CLIENT/SERVER ARCHITECTURE:

Popular paradigms of computing are: Central Computing (a computer running client part
of the software), a Server machine (a high-end configuration computer running server part of the
software), a Physical Network Connection (like Ethernet, Token Ring etc), and a software on the
Client and Server machines (following a common protocol like TCP\IP, SPX\IPX etc.) that
carries data from Client machines to the server machines and vice-versa. The server software is
continuously running and is writing for the Client to contact it and ready is to respond.

The client machine (software) requests for the service from the Server software
(machines). The server machine responds by giving the required data to the Client.The Client
machine formats the data given by the server to the required format and displays in an user-
friendly way. In the Client/Server configuration, both the Server machine and Client machine are
required to have software.

When mini systems and legendary mainframes were popular, applications are written to
be used on the terminals (mostly dumb) connected to the machines using the Central server for
all the work involved. With the advent of desktops and smaller (but very powerful) servers, the
computing environment shifted towards Client/Server paradigm.

There are two types of Client/Server environments.

i) Thick Client – in this model, the Client and Server share processing of data.
Here, both the Server and theClient machine are full-fledged computer shaving
their own CPU, memory, hard-disk, good quality display system and other
peripherals. The server holds the database and will listen to request from any
client. The client would send a request for a set of records. The server responds by
supplying the requested data. If necessary, the client would do its own processing
on the data. Then the client would present the data in the way the user wants.
ii) Thin Client -- In this environment, the database, application and the processing
logic is available only at the Server. The client machine is not a full fledged
computer but has a minimal computer but has a minimal functionality to display
the data supplied by the server.

The client-server model has been around for a while. In corporate environment, it is used to
design networks and applications that distribute the processing load between a user’s computer
and server. Client – Server systems take advantage of the intelligence resident in both the client
and the server and also take advantage of the network’s communication system.
17

TESTING

Before actually implementing the new system into operation, a test run of the system is done
removing all the bugs, if any, it is an important phase of a successful system. After codifying the
whole programs of the system, a test plan should be developed and run on a given set of test
data. The output of the test run should match the exception results.

Testing on integrates software tests case design techniques into well-planned series steps
that result in the successful construction of software. A software testing strategy should be
flexible enough to promote the creativity and customization that are necessary to adequately test
all large software based systems. System testing is an expensive but critical process.

UNIT TESTING:

When the programs have been coded and brought to working conditions they must be
individually tested with the prepared test data. Any undesirable happening must be noted and
debugged (error corrections). This test was performed with the test data unit focuses verification
effort on the smallest unit of software design. The software units in a system are the modules and
routines that are assembled and integrated to perform a specific function. In a large system many
modules at different levels are needed.

Unit testing focuses on the modules independently of one another to locate errors. This
enables to detect errors in coding and logic that are contained within that module alone.

Those resulting from the interaction between modules are initially avoided. Unit testing
can be performed from the bottom up, starting with the smallest and lowest level modules and
proceeding modules. Top-down testing begins with the upper level modules.
A unit is defined as a small program or piece of code , which can work independently. Once a
unit coded and compiled and brought to working conditions, they must be individually tested
with the prepared test data. This is called Unit Testing. Unit testing cases are scripted before the
actual unit testing. The test cases must be exhaustive and must cover all the scenarios that might
arise when the unit is actually used. Care should be taken that both positive and negative
scenarios are covered. In the unit test cases, the scenario to be tested, the test data has to be used
and the expected behavior of the unit is captured.

Unit testing is done exhaustively using the unit test cases and the actual behavior of the
unit is captured. During the unit testing any desirable happening must be noted and debugs are
eliminated. The unit has to be retested so that the actual behavior is same as expected behavior.
By doing the unit testing thoroughly, many errors can be trapped and fixed which otherwise
would be very difficult to trap or consume a lot of time and effort to trap and fix at a later stages.

Each and every unit is subjected to thorough unit testing and once it is found error free, it
is taken to the next stage, which is integration with the other units.
18

INTEGRATION / SYSTEM TESTING:

After each unit has been tested thoroughly and error free, all the units are integrated to
form the complete system. After the integration is completed system testing is performed.

A system test plan is prepared which provides a summary of the approaches to be used
for system testing including the features that have to be tested, how the testing has to be
organized, the tasks that have to be organized.

Once the system test plan is prepared, system test cases are scripted. Care should be taken
while scripting system test cases that each and every scenario that might arise in the system is
covered. A system test case describes the scenario that has to be tested, the steps to be followed
for testing, the actual data to be used for testing and the expected behavior of the system.

After scripting the STC’s, system Testing is done. During the system testing, each test
case is executed using the actual data and actual behavior is recorded for each case. The actual
behavior is analyzed for each and at any stage, if it is found that the actual behavior is not
matching with the expected behavior of the system then the errors in the particular programs are
identified and are fixed and further tested for the expected behavior.

USER ACCEPTANCE TESTING:

When it is ensured that the system is running error free, the users are called with their
own actual data so that the system could be shown running as per their requirements. This is
called User Acceptance Testing. Any errors captured at this stage are fixed and the entire system
is subjected to performance tuning, so that the performance is for the users expectations and the
system is made ready for implementation.
19