You are on page 1of 16



You are probably reading this foreword with one of several things in mind. First, is this the right project
for us, is the material current, and does the architecture reflect a good solution? Second, what should We expect
to learn and where should We start using a project of this length?
Many of the forewords We have seen will lead you through an amusing anecdote or story and then tell
a little about the author, but then fail to leave you any wiser about the answer to those questions. So,
to get straight to the point and to answer the second question first, this is a project that you can start from
day one and use right through to the end. If you havent used any of our projects before, you
are in for a pleasant surprise. Project style is very accessible, which makes the content easy to follow and
understand. We know, because We have read this project from cover to cover.
This edition of Online Air Ticket Booking is based on the J2SE 5.0 platform. The J2SE 5.0
release is one of the most significant updates to the Java platform in many years and has been three
years in the making. The release involved 5 experts , all working through the Java
Community Process and focused on making the platform better for all users. We have been involved
with the project since day one . As such, We had a great interest in making sure that this project is accurate and
matches the final expectation .Weve even compiled and run every module example twice, and there are a lot of
features, as you will find out.

While a project is usually attributed to the developers, a project particularly a large project such as this is
always the result of the efforts of a sizeable team of people. Wed therefore like to thank all the editorial
and production staff at CMC and HCL who worked so hard to produce this edition of our Project from
our initial draft.
Wed especially like to thank Mr OM and Mr Tanay Mishra of CMC for their extensive technical input. They
somehow found the time to go through the complete project and try out all the modules twice in spite
of the considerable demands of their day job. Mr Oms suggestions for improvements were invaluable, as
was his ability to spot our mistakes, and We are particularly grateful of Mr Tanay Mishras indications of where
Wed missed some of the inevitable changes arising from the evolution of the project during the beta phases.
Any errors that remain are, of course, our own, but there are surely fewer of them as a consequence of
teams efforts.
Wed also like to thank other staff memebers of CMC for their numerous suggestions for corrections
and improvements. In addition to the many changes that We made in response to these, We also updated and
reintroduced the features on using JDBC that were omitted from the previous versions , in response to requests
from a number of users. The greatly increased flexibility of this version over the previous versions is only in
part a consequence of restoring the facts and fetaures. The bulk of the additional functionality is attributable to
new material relating to the features introduced by J2SE 5.0 that deliver exciting new capabilities for every Java
programmer. The Online Air Ticket Booking release is truly a major step forward that encompasses important
extensions to AIR TICKET BOOKING as well as major additions to the smooth functioning of the departments.


Introduction to Online Air Ticket


With the wide spread presence of internet gone are the days of long ques and agonizing delays in booking
Air/train/bus tickets, hotel reservation and other necessary things.
Today every thing from applying for a passport to getting a visa and booking a ticket are possible on just a click
of the mouse.
As the technology is improving all sort of information is available under single portal and readily accessible to
almost everyone.
Online Air Ticket Booking is a web based Application which is developed keeping in mind the increased use
of airlines as a mode of travel and need of a online system for enquiring flight schedule, booking of air tickets,
And getting information about various travel destinations.

Developed by a team of highly competitive Engineers Online Air Ticket Booking provides facilities like

Booking of Ticket
Enquire about the flight schedule
Information about various travel destinations
Cancellation of Tickets
Extanding of the Date of travel

Tools Used
SQL Server
Microsoft SQL Server 2005 is a database and data analysis platform for large-scale online transaction
processing (OLTP), data warehousing, and e-commerce applications. SQL Server 2005 contains these
SQL Server
Database Engine

The Database Engine is the core service for storing, processing, and securing data. The
Database Engine provides controlled access and rapid transaction processing to meet the
requirements of the most demanding data consuming applications within your enterprise.
The Database Engine also provides rich support for sustaining high availability.

Analysis Services delivers online analytical processing (OLAP) and data mining
functionality for business intelligence applications. Analysis Services supports OLAP by
allowing you to design, create, and manage multidimensional structures that contain data
SQL Server Analysis
aggregated from other data sources, such as relational databases. For data mining
Services Overview
applications, Analysis Services allows you to design, create, and visualize data mining
models, constructed from other data sources by using a wide variety of industry-standard
data mining algorithms.
SQL Server
Integration Services is an enterprise data transformation and data integration solution that
Integration Services you can use to extract, transform, and consolidate data from disparate sources and move it
(SSIS) Overview
to single or multiple destinations.

SQL Server

Replication is a set of technologies for copying and distributing data and database objects
from one database to another and then synchronizing between databases to maintain
consistency. Using replication, you can distribute data to different locations and to remote
or mobile users over local and wide area networks, dial-up connections, wireless
connections, and the Internet.

Reporting Services is a new server-based reporting platform that you can use to create and
SQL Server
manage tabular, matrix, graphical, and free-form reports that contain data from relational
Reporting Services
and multidimensional data sources. The reports that you create can be viewed and managed
over a Web-based connection.
Notification Services is the platform for developing and deploying applications that
SQL Server
generate and send notifications. Notification Services can generate and send timely
Notification Services
personalized messages to thousands or millions of subscribers, and deliver them to a wide
variety of devices.
SQL Server Service Service Broker is a technology for building reliable, scalable, and secure database
Broker Overview
applications. Service Broker is a technology within the Database Engine that provides
native support for queuing. Service Broker also provides a message-based communication
platform that can be used to link disparate application components into a functioning
whole. Service Broker provides much of the infrastructure necessary to build a distributed
application, significantly reducing the application development time. Service Broker also

makes it easy to scale your application up or down to accommodate the amount of traffic
the application is receiving.
Full-Text Search

SQL Server contains the functionality you need to issue full-text queries against plain
character-based data in SQL Server tables. Full-text queries could include words and
phrases or multiple forms of a word or phrase.

SQL Server Tools

and Utilities

SQL Server provides the tools you need to design, develop, deploy, and administer
relational databases, Analysis Services cubes, data transformation packages, replication
topologies, reporting servers, and notification servers.

You can run Java programs on a wide variety of computers using a range of operating systems. Your Java
programs will run just as well on a PC running any supported version of Microsoft Windows as it will
on Linux or a Sun Solaris workstation. This is possible because a Java program does not execute directly
on your computer. It runs on a standardized environment called the Java 2 Platform that has been
imple-mented as software on a wide variety of computers and operating systems. The Java Platform consists of
two elements a software implementation of a hypothetical computer called the Java Virtual Machine
(JVM) and the Java Application Programming Interface (Java API), which is a set of software compo-nents
that provides the facilities you need to write a fully fledged interactive application in Java.
A Java compiler converts the Java source code that you write into a binary program consisting of byte-codes.
Bytecodes are machine instructions for the Java Virtual Machine. When you execute a Java pro-gram,
a program called the Java interpreter inspects and deciphers the bytecodes for it, checks it out to ensure that it
has not been tampered with and is safe to execute, and then executes the actions that the
bytecodes specify within the Java Virtual Machine. A Java interpreter can run standalone, or it can be
part of a web browser such as Netscape Navigator, Mozilla, or Microsoft Internet Explorer where it can
be invoked automatically to run applets in a web page.
Because your Java program consists of bytecodes rather than native machine instructions, it is completely
insulated from the particular hardware on which it is run. Any computer that has the Java environment
implemented will handle your program as well as any other, and because the Java interpreter sits between
your program and the physical machine, it can prevent unauthorized actions in the program from being
In the past, there has been a penalty for all this flexibility and protection in the speed of execution of
your Java programs. An interpreted Java program would typically run at only one-tenth of the speed
of an equivalent program using native machine instructions. With present Java machine implementa-tions,
much of the performance penalty has been eliminated, and in programs that are not computation
intensive which is usually the case with the sort of program you would want to include in a web page,
for example you really wouldnt notice this anyway. With the JVM that is supplied with the current
Java 2 Development Kit (JDK) available from the Sun web site, there are very few circumstances where
you will notice any appreciable degradation in performance compared to a program compiled to native
machine code.
The JavaTM programming language is designed to meet the challenges of application development in the
context of heterogeneous, network-wide distributed environments. Paramount among these challenges is secure
delivery of applications that consume the minimum of system resources, can run on any hardware and software
platform, and can be extended dynamically.
The Java programming language originated as part of a research project to develop advanced software for a
wide variety of network devices and embedded systems. The goal was to develop a small, reliable, portable,
distributed, real-time operating platform. When the project started, C++ was the language of choice. But over

time the difficulties encountered with C++ grew to the point where the problems could best be addressed by
creating an entirely new language platform. Design and architecture decisions drew from a variety of languages
such as Eiffel, SmallTalk, Objective C, and Cedar/Mesa. The result is a language platform that has proven ideal
for developing secure, distributed, network-based end-user applications in environments ranging from networkembedded devices to the World-Wide Web and the desktop

1.2 Design Goals of the JavaTM Programming Language

The design requirements of the JavaTM programming language are driven by the nature of the computing
environments in which software must be deployed.
The massive growth of the Internet and the World-Wide Web leads us to a completely new way of looking at
development and distribution of software. To live in the world of electronic commerce and distribution, Java
technology must enable the development of secure, high performance, and highly robust applications on
multiple platforms in heterogeneous, distributed networks.
Operating on multiple platforms in heterogeneous networks invalidates the traditional schemes of binary
distribution, release, upgrade, patch, and so on. To survive in this jungle, the Java programming language must
be architecture neutral, portable, and dynamically adaptable.
The system that emerged to meet these needs is simple, so it can be easily programmed by most developers;
familiar, so that current developers can easily learn the Java programming language; object oriented, to take
advantage of modern software development methodologies and to fit into distributed client-server applications;
multithreaded, for high performance in applications that need to perform multiple concurrent activities, such as
multimedia; and interpreted, for maximum portability and dynamic capabilities.
Together, the above requirements comprise quite a collection of buzzwords, so let's examine some of them and
their respective benefits before going on.

1.2.1 Simple, Object Oriented, and Familiar

Primary characteristics of the Java programming language include a simple language that can be programmed
without extensive programmer training while being attuned to current software practices. The fundamental
concepts of Java technology are grasped quickly; programmers can be productive from the very beginning.
The Java programming language is designed to be object oriented from the ground up. Object technology has
finally found its way into the programming mainstream after a gestation period of thirty years. The needs of
distributed, client-server based systems coincide with the encapsulated, message-passing paradigms of objectbased software. To function within increasingly complex, network-based environments, programming systems
must adopt object-oriented concepts. Java technology provides a clean and efficient object-based development
Programmers using the Java programming language can access existing libraries of tested objects that provide
functionality ranging from basic data types through I/O and network interfaces to graphical user interface
toolkits. These libraries can be extended to provide new behavior.

Even though C++ was rejected as an implementation language, keeping the Java programming language
looking like C++ as far as possible results in it being a familiar language, while removing the unnecessary
complexities of C++. Having the Java programming language retain many of the object-oriented features and
the "look and feel" of C++ means that programmers can migrate easily to the Java platform and be productive

1.2.2 Robust and Secure

The Java programming language is designed for creating highly reliable software. It provides extensive
compile-time checking, followed by a second level of run-time checking. Language features guide programmers
towards reliable programming habits.
The memory management model is extremely simple: objects are created with a new operator. There are no
explicit programmer-defined pointer data types, no pointer arithmetic, and automatic garbage collection. This
simple memory management model eliminates entire classes of programming errors that bedevil C and C++
programmers. You can develop Java code with confidence that the system will find many errors quickly and that
major problems won't lay dormant until after your production code has shipped.
Java technology is designed to operate in distributed environments, which means that security is of paramount
importance. With security features designed into the language and run-time system, Java technology lets you
construct applications that can't be invaded from outside. In the network environment, applications written in
the Java programming language are secure from intrusion by unauthorized code attempting to get behind the
scenes and create viruses or invade file systems.

1.2.3 Architecture Neutral and Portable

Java technology is designed to support applications that will be deployed into heterogeneous network
environments. In such environments, applications must be capable of executing on a variety of hardware
architectures. Within this variety of hardware platforms, applications must execute atop a variety of operating
systems and interoperate with multiple programming language interfaces. To accommodate the diversity of
operating environments, the Java CompilerTM product generates bytecodes--an architecture neutral
intermediate format designed to transport code efficiently to multiple hardware and software platforms. The
interpreted nature of Java technology solves both the binary distribution problem and the version problem; the
same Java programming language byte codes will run on any platform.
Architecture neutrality is just one part of a truly portable system. Java technology takes portability a stage
further by being strict in its definition of the basic language. Java technology puts a stake in the ground and
specifies the sizes of its basic data types and the behavior of its arithmetic operators. Your programs are the
same on every platform--there are no data type incompatibilities across hardware and software architectures.
The architecture-neutral and portable language platform of Java technology is known as the Java virtual
machine. It's the specification of an abstract machine for which Java programming language compilers can
generate code. Specific implementations of the Java virtual machine for specific hardware and software
platforms then provide the concrete realization of the virtual machine. The Java virtual machine is based
primarily on the POSIX interface specification--an industry-standard definition of a portable system interface.

Implementing the Java virtual machine on new architectures is a relatively straightforward task as long as the
target platform meets basic requirements such as support for multithreading.

1.2.4 High Performance

Performance is always a consideration. The Java platform achieves superior performance by adopting a scheme
by which the interpreter can run at full speed without needing to check the run-time environment. The automatic
garbage collector runs as a low-priority background thread, ensuring a high probability that memory is available
when required, leading to better performance. Applications requiring large amounts of compute power can be
designed such that compute-intensive sections can be rewritten in native machine code as required and
interfaced with the Java platform. In general, users perceive that interactive applications respond quickly even
though they're interpreted.

1.2.5 Interpreted, Threaded, and Dynamic

The Java interpreter can execute Java bytecodes directly on any machine to which the interpreter and run-time
system have been ported. In an interpreted platform such as Java technology-based system, the link phase of a
program is simple, incremental, and lightweight. You benefit from much faster development cycles-prototyping, experimentation, and rapid development are the normal case, versus the traditional heavyweight
compile, link, and test cycles.
Modern network-based applications, such as the HotJavaTM Browser for the World Wide Web, typically need
to do several things at the same time. A user working with HotJava Browser can run several animations
concurrently while downloading an image and scrolling the page. Java technology's multithreading capability
provides the means to build applications with many concurrent threads of activity. Multithreading thus results in
a high degree of interactivity for the end user.
The Java platform supports multithreading at the language level with the addition of sophisticated
synchronization primitives: the language library provides the Thread class, and the run-time system provides
monitor and condition lock primitives. At the library level, moreover, Java technology's high-level system
libraries have been written to be thread safe: the functionality provided by the libraries is available without
conflict to multiple concurrent threads of execution.
While the Java Compiler is strict in its compile-time static checking, the language and run-time system are
dynamic in their linking stages. Classes are linked only as needed. New code modules can be linked in on
demand from a variety of sources, even from sources across a network. In the case of the HotJava Browser and
similar applications, interactive executable code can be loaded from anywhere, which enables transparent
updating of applications. The result is on-line services that constantly evolve; they can remain innovative and
fresh, draw more customers, and spur the growth of electronic commerce on the Internet.

1.3 The Java Platform--a New Approach to Distributed Computing

Taken individually, the characteristics discussed above can be found in a variety of software development
platforms. What's completely new is the manner in which Java technology and its runtime environment have
combined them to produce a flexible and powerful programming system.

Developing your applications using the Java programming language results in software that is portable across
multiple machine architectures, operating systems, and graphical user interfaces, secure, and high performance.
With Java technology, your job as a software developer is much easier--you focus your full attention on the end
goal of shipping innovative products on time, based on the solid foundation of the Java platform. The better way
to develop software is here, now, brought to you by the Java platform.

Tomcat Web Server

Use this server and its libraries for the following activities:

Deploying web applications, JSP pages, and servlets.

Deploying web services and web service clients that use JSR-101 stubs.
o The Tomcat Web Server is not a J2EE 1.4 container. Therefore, you cannot deploy a web service
client that uses JSR-109 stubs to this server. When you create the web service client, make sure
that you select IDE-generated static stub in the Client Type drop-down.

JavaServer Pages (JSP) is a technology based on the Java language and enables the development of dynamic
web sites. JSP was developed by Sun Microsystems to allow server side development. JSP files are HTML files
with special Tags containing Java source code that provide the dynamic content.
The following shows the Typical Web server,different clients connecting via the Internet to a Web server. In this

example,the Web server is running on Unix and is the very popular Apache Web s

First static web pages were displayed. Typically these were people?s first experience with making web pages so
consisted of My Home Page sites and company marketing information. Afterwards Perl and C were languages
used on the web server to provide dynamic content. Soon most languages including Visualbasic,Delphi,C and
Java could be used to write applications that provided dynamic content using data from text files or database
requests. These were known as CGI server side applications. ASP was developed by Microsoft to allow HTML
developers to easily provide dynamic content supported as standard by Microsoft?s free Web Server,Internet
Information Server (IIS). JSP is the equivalent from Sun Microsystems,a comparison of ASP and JSP will be
presented in the following section.

The following diagram shows a web server that supports JSP files. Notice that the web server also is connected
to a database.

JSP source code runs on the web server in the JSP Servlet Engine. The JSP Servlet engine dynamically
generates the HTML and sends the HTML output to the client?s web browser.

Why use JSP?

JSP is easy to learn and allows developers to quickly produce web sites and applications in an open and
standard way. JSP is based on Java,an object-oriented language. JSP offers a robust platform for web
Main reasons to use JSP:

Multi platform
Component reuse by using Javabeans and EJB.
Advantages of Java.
You can take one JSP file and move it to another platform,web server or JSP Servlet engine.

This means you are never locked into one vendor or platform.

HTML and graphics displayed on the web browser are classed as the presentation layer. The Java code (JSP) on
the server is classed as the implementation.

By having a separation of presentation and implementation,web designers work only on the presentation and
Java developers concentrate on implementing the application.

Tables Used

airline stores the detaisl of the flights
1) sno
2) flight_name
3) no_of_seats
4) start
5) destination
6) fare
7) dep_date




cancellation stores the details of cancelled ticktes.

1) cancel_ticket
2) no_ticket_cancel
3) dep_date
4) start
5) destination
6) sno



passenger stores the details of the passenger booking ticket.
1) name
2) email
3) no_of_tickets
4) first_ticket
5) flight_name
6) amount
7) no_ticket_cancel
8) cancel_ticket
9) sno



The Following books were preferred to make the project
1.Java 2 Complete Reference

2.JSP Complete Reference

3.HTML Unleashed.
4.Java 2 Beginners Guide.
5.CMC Study Materials
Total Time Taken: 1 month