8/22/2019 Enquirys Project Documentation
1/36
SUBMITTED TO
CENTRAL BOARD OF SECONDARY EDUCATION,
CHENNAI
ENQUIRIES DATABASE
INFORMATICS PRACTICES
(CLASS XII)
2011-2013
Submitted To: Submitted By:
Department of
Informatics Practices Name:
Reg.No:
MP & EV ENGLISH MEDIUM SCHOOL
VISAKHAPATNAM
YEAR 2011-2013
8/22/2019 Enquirys Project Documentation
2/36
CERTIFICATE
This is to certify that the project entitled ENQUIRIES
DATABASE MANAGEMENT SYSTEM is a work of
_________________________________________________ with
registration number _____________done as practical fulfillment of
the requirement for the award of the Class-XII from MP & EV
ENGLISH MEDIUM SCHOOL for the academic year 2011-2013.
HEAD OF THE DEPARTMENT(INFORMATICS PRACTICES)
EXTERNAL EXAMINER INTERNAL EXAMINER
8/22/2019 Enquirys Project Documentation
3/36
ACKNOWLEDGEMENT
I am greatly indebt towards the principal of MP & EV ENGLISH
MEDIUM SCHOOL for giving me an opportunity in elaborating my
knowledge towards this subject (INFORMATICS PRACTICES) by
completing this project work. I would like to thank all my teachers
under whose able guidance. I was able to complete this project work.
I express my sincere thanks and gratitude towards our lecturer Srinivas
Kumar sir for his support and guidance through out the project. I would
also like to thank our beloved project guidance teacher who have
encouraged and co-operated with me during this project.
By
Name :
Reg. No. :
8/22/2019 Enquirys Project Documentation
4/36
INDEX
1. Abstract
2. Literature Survey
a. My SQL
b. Java
3. Software Requirement Specification
4. Data Flow Diagram
5. Sample Forms
6. Sample Code
7. Table Code
8. Bibliography
8/22/2019 Enquirys Project Documentation
5/36
ABSTRACT
My project titled ENQURIES was developed to computerize the existing
system of maintaining the records of the enquiries. This project is preparedwith a view of reducing the burden of manual procedures by adopting
modern methods of automation, which is expected to encompass the entire
operation
First step towards achieving this goal is to organize the information At hand
in a logical manner so as to insure easy access, retrieval and Update of data.
For this we create separate tables to represent entities Involved S.no,
Enquiry date, name. Address, sex, age, phone, school
The following pages will give you a overview of how the database
Software for Student enquiries has been designed.
The main advantages of using this system are
Manpower required maintaining database is greatly reduced. Improves the work efficiency in enquiry of students Less prone to error Stops redundancy it provides you with a user name and password for data
security
Reduces cost in maintaining data We can develop various reports like
Date wise Report
Name wise Report
All the Enquiries
Instant details about the students can be retrieved. It helps in easy updating of the database with Update/Add option.
8/22/2019 Enquirys Project Documentation
6/36
LITERATURE
SURVEY
8/22/2019 Enquirys Project Documentation
7/36
My SQL
Introduction
The collection of data, usually referred to as the database, contains
information about the particular enterprise. A database management system
(DBMS) consists of a collection of interrelated data and a set of programs to
access those data. The primary goal of a DBMS is to provide an
environment that is both convenient to use in retrieving and storing database
information. The modern database system is one of the most powerful tools
you can use to build business applications.
DBMS
In the last two decades, with the rapid and steady growth of
computerization, organizations have realized the value of information As a
resource and the importance of the speed and ease with which raw data can
be processed into useful information.
To optimally exploit this potential of the information, organization have
committed large amounts of funds towards the collection of the data and
keeping this data up to date, by investing on the people, hardware and the
software to manage this data. This set of interrelated data are is known as
database and the softer that manages it once interrelationships are specified,
is known as database management system DBMS
8/22/2019 Enquirys Project Documentation
8/36
DBMS can be described as a computer based record keeping system, which
consists of software for processing a collection of interrelated data. The
data is completely managed by the DBMS, and can be accessed by end users
via application programs developed by designers and programmers.
Application programs are typically required to capture data, update it,
periodically clean it up, and to present it as information after processing it
meaningfully. The designers and programmers use a combination of high
languages (such as COBOL, c, FORTRAN) and fourth generation language
(4GL such as SQL) tools to build these application programs.
A person called database administer or DBA centrally manages the database
.The DBA decides on the type of the data that Is to be held the structures in
which it is to be held the structures in which it is to be held and the
interrelations between data structures and defines these to the DBMS. The
DBA usually controls access to the data thorough user codes and passwords
and by restricting the types of operations that they can perform on it .The
DBA also uses certain tools available with DBMS to fine tune the database
so that information is available immediately on requirement.
Designers and programmers help DBA is structure and optimizing the
database design. They also develop application system for end user.
Need for DBMS:
The main reason to choose a database system is, it provides a centralized
control of its operational data-which is one of its most valuable assets. Some
of the advantages that can be occurred from having centralized control of
the data are:
8/22/2019 Enquirys Project Documentation
9/36
Characteristics of DBMS
The predominant advantages of DBMS are discussed below.
1. Redundancy can be reduced
2. Inconsistency can be avoided
3. Data can be shared
4. Standards can be enforced
5. Security restrictions can be applied
6. Integrity can be maintained
7. Data independence
8. Processing speed
9. Hardware Independence
Introduction to RDBMS
The My SQL database was designed using the relational model and gives
users many advantages
A database structure that is easy to visualize and understand
The ability to create any number of temporary relationships
between tables.
Freedom from concerns about how to query the database, through
use of SQL.
Tables easy to visualize
Relational joins that provide temporary sets of data from multiple
tables in the model
8/22/2019 Enquirys Project Documentation
10/36
What is a relational database?
IBMs, Dr E.F.Codd first proposed the relational model in 1970, but it had
little practical significance until relational DBMS products becomes
available in the 1980s. Dr. Codd in 1985 paper laid out 12 rules for
relational database.
In the relational model, only one type of data structures exists-the table .The
uniformity of the relational model gave rise to a new type of high -level
database language produces new tables by sub setting and/or combining
existing tables. By issuing a single language command, you can retrieve an
entire set of record (called rows) from one or more existing tables into a new
table (called a result table) that you can in turn operate once again. This set-
a -time approach means that single relational command can retrieve, update
or delete multiple records stored in the database. Also you specify
operations in terms of what is to be done, not how to do it. In other words, a
relational language is non-procedural as well as set-a-time.
In the relational model, the relationships between tables are created on a
temporary basis by an end users request for information. These temporary
relationships can be setup in several ways many parents/many children, one
parent/many children, one parent/one child-depending on the query used.
The main advantage of this kind of database is that any column in any table
can be directly related to any other column in the table.
Both the network and hierarchical models require that relationships be
predefined. Adding new relationships to an already existing database is
8/22/2019 Enquirys Project Documentation
11/36
more difficult with these two models than it is using the relational model.
Unlike the relational model, where the relation ships are established by data
values, the hierarchical and network models represent relationships by
means of separate data structures, such as indexes and linked lists. These
data structures must be established by the DBMS before the relationship can
be present.
Relational Structure
The organizing principle in a relational database is the table; a rectangular
row-column arrangement of data values, each table in a database has a
unique table name that identifies its contents. A relation is a formal for a
table.
The row (or record) in the table is formally called a tuple. Each column in a
table has a column name. The columns of a table must all different names.
The column (or field) is formally called an attribute. The number of tuple is
called the cardinality and the number of attributes is called the degree.
One important property of a relation is that the rows are unordered. A row
cannot be identified by its position on the table. Every table must have some
column or combination of columns that uniquely identify each row in the
table. At any given time, no two rows of the table contain the same values in
that column or column combination. This column (or columns) is called
primary key of the table. A table where every row is different from all other
rows is called a relation in mathematically terms. In relational systems,
8/22/2019 Enquirys Project Documentation
12/36
missing or unknown information can be presented as NULL. If a row has
the value NULL is not the same as spaces or zero.
Introduction to My SQL
My SQL is a relational database management system or RDBMS for short.
My SQL being and RDBMS stores data in tables called relations. These
relations are two-dimensional representations of data where the rows called
tuples in relational jargon - represent record, and the columns attributes are
pieces of information contained in the record. My SQL provides a rich set of
tools to allow design, and maintenance, of this database.
Benefits of SQL
Non-procedural language
Common language for all databases i.e. portable and it requires only small
modification to make use in other database. Very simple commands for
querying, inserting, deleting and modifying data and objects
Integrity Constraints
It is a mechanism used by My SQL to prevent invalid data entry into the
table. The following are the various types of integrity constraints.
Domain integrity constrains
NOT NULL
CHECK
8/22/2019 Enquirys Project Documentation
13/36
Entity integrity constrains
Maintain uniqueness in a record
UNIQUE CONSTRAINT
PRIMARY KEY CONSTRAINT
Relational Integrity constraints
Enforces relationship between tables.
8/22/2019 Enquirys Project Documentation
14/36
JAVA
Java was conceived by James Gosling, Patrick Naughton, Chris Warth, Ed
Frank and Mike Sheridan at Sun Microsystems Inc.in 1991. It took 18
months to develop the first working version. This language was initially
called Oak but was renamed as Java in 1995. Between the initial
implementation of Oak in the fall of 1992 and the public announcement of
Java in the spring of 1995, many more people contributed to the design and
evolution of the language.
The main properties of the Java, which made Java so popular, are as follows:
1. Simple and Secure
2. Portable and Dynamic
3. Object-Oriented
4. Robust
5. Multithreaded
6. Architecture-Neutral
7. Interpreted
8. High performance
9. Distributed
The most striking feature of the language is that is a platform-neutral
language. Java is first programming language that is not tied to any
particular hardware or operating system. Programs developed in Java can be
executed anywhere on any system.
8/22/2019 Enquirys Project Documentation
15/36
THE KEY FEATURES OF JAVA IS BYTE CODE:
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 runtime systems, 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 has a bit of surprise.
Translating a Java program into a byte code helps and makes it much easier
to run a program in a wide variety of environments. The reason is
straightforward only the JVM needs to be implemented for each platform.
Once the runtime package exists for a given system, any Java program can
run on it. Remember, although the details of the JVM will differ from
platform to platform, all interpret the same Java Byte code.
JAVA ENVIRONMENT:
Java environment includes a large number of development tools and
hundreds of classes and methods. The development tools are the part of the
system known as Java Development Kit (JDK) and the classes are methods
are part of the Java standard library (JSL), also known as the Application
Programming Interface (API).
8/22/2019 Enquirys Project Documentation
16/36
JAVA DEVELOPMENT KIT:
The Java development kit comes with a collection of tools that are used for
developing and running Java programs. They include:
1. Applet Viewer (for viewing Java Applets)
2. Javac (Java Compiler)
3. Java (Java interpreter)
4. Javap (Java Disassembler)
5. Javah (for C header files)
6. Javadoc (for creating HTML documents)
7. Jdb (Java Debugger)
APPLICATION PROGRAMMING INTERFACE:
The Java standard library includes hundreds of classes and
methods grouped into several functional packages. Most commonly used
packages are:
1. Language support package: A collection of classes and methods
required for implementing basic features of java.
2. Utilities package: A collection of classes to provide utility functions
such as date and time functions.
3. Input/Output package: A collection of classes required for input &
output manipulations.
4. Networking package: A collection of classes for communication with
other computers via Internet.
5. AWT package: The abstract window toolkit package contains classes
that implements platform independent graphical user interface.
8/22/2019 Enquirys Project Documentation
17/36
JAVA DATABASE CONNECTIVITY (JDBC)
The Java database connectivity Application Programming Interface (API) is
an API currently being designed by Sun Microsystems that provides a Java
language interface with SQL Call Level Interface standard. This standard
provides a DBMS independent interface to relational databases that defines a
generic SQL database access framework.
The most visible implementation of the SQL CLI is Microsofts ODBC
(Open Database Connectivity). This API defines a common SQL syntax and
function calls that can be used by developers to send SQL commands to and
retrieve data from SQL databases. ODBC - enabled applications make use of
database drivers (similar to other device drivers) installed on the system that
allows applications to talk to a vendors database. Using this methodology,
all of the DBMS specific code is placed inside the ODBC driver and the
application developer is shielded from implementation specific problems in
theory. Practically speaking, it is sometimes difficult to completely remove
vendors specific syntax from all ODBC operations, but in most cases, it is
relatively simple task to port ODBC to run on a new database server.
ODBCs primary drawback is that it is written in C. Because of the
limitations inherent in the use of native methods, the JDBC designers have
designed the JDBC specification to most easily use ODBC in short-term, but
they have provided the capability long-term for JDBC to be implemented in
other ways.
8/22/2019 Enquirys Project Documentation
18/36
NOTE: JDBC, like ODBC, is designed to be a Call Level SQL Interface.
Because many of its many of its low-level operations can be combined into a
higher level, object oriented interface, except to see Java class libraries
released in the future that provide a mapping to the underlying JDBC Calls.
This happened with ODBC almost immediately, and the majority of ODBC
developers currently use other Interface rather than using ODBC API
directly.
The JDBC API is expressed as a series of abstract Java interfaces within the
java.sql package. Here are the most commonly used interfaces:
java.sql.DriverManager manages the loading and unloading of database
drivers from the underlying systems.
java.sql.Connection Handles the connections to a specific database.
java.sql.Statement contains an SQL statement to be passed to the
database: two sub-types in this interface are the PreparedStatement (for
executing a Pre-Compiled SQL statement) and the CallableStatement (for
executing a database stored procedure).
java.sql.ResultSet contains the record result set from the SQL statement
passed to the database
8/22/2019 Enquirys Project Documentation
19/36
HARDWARE AND SOFTWARE
REQUIREMENTS
Hard ware Specification:
Processor : Dual Core
Processor Speed : 1.0MHz
RAM : 512MB
Hard Disk : 160GB
Software Specification
Language : JDK 1.6
Database : My SQL
IDE : Netbeans 6.0
Operating System : Windows XP
8/22/2019 Enquirys Project Documentation
20/36
Sample Forms
8/22/2019 Enquirys Project Documentation
21/36
8/22/2019 Enquirys Project Documentation
22/36
8/22/2019 Enquirys Project Documentation
23/36
private void LogInBActionPerformed(java.awt.event.ActionEvent evt) {
String PWord = PassWordTF.getText();
String ID = IDTF.getText();
String str = null;
Statement stmt=null;
ResultSet rs = null;
try {
Class.forName("java.sql.Driver");
String database = "jdbc:mysql://localhost:3306/enquirys";
Connection conn = DriverManager.getConnection(database, "root", "root");
stmt = conn.createStatement();
String sql = "select * from LogIn where ID = '" + ID + "'";
rs = stmt.executeQuery(sql);
rs.next();
str = rs.getString("Password");
rs.close();
stmt.close();
conn.close();
if(str.equals(PWord)) {
MainMenu m = new MainMenu();
m.setVisible(true);
this.dispose();
} else {
InvalidL.setText("Incorrect ID or Password");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e); InvalidL.setText("Incorrect ID or Password");} }
8/22/2019 Enquirys Project Documentation
24/36
private void addBtnActionPerformed(java.awt.event.ActionEvent evt)
{
AddEnquiry m = new AddEnquiry();
m.setVisible(true);
this.setVisible(false);
}
private void ReportsBtnActionPerformed(java.awt.event.ActionEvent evt)
{
Report m = new Report();
m.setVisible(true);
this.setVisible(false);
}
private void exitBtnActionPerformed(java.awt.event.ActionEvent evt)
{
this.dispose();
}
8/22/2019 Enquirys Project Documentation
25/36
8/22/2019 Enquirys Project Documentation
26/36
8/22/2019 Enquirys Project Documentation
27/36
private void returnBtnActionPerformed(java.awt.event.ActionEvent evt) {
new MainMenu().setVisible(true);
this.setVisible(false);
}
8/22/2019 Enquirys Project Documentation
28/36
private void saveBtnActionPerformed(java.awt.event.ActionEvent evt) {
char gender = 'M';
if (MaleRB.isSelected()) {
gender = 'M';
} else if (FemaleRB.isSelected()) {
gender = 'F';
}
int age = Integer.parseInt(AgeTF.getText());
try {
Class.forName("com.mysql.jdbc.Driver");
String database = "jdbc:mysql://localhost:3306/Enquirys";
Connection conn = DriverManager.getConnection(database, "root", "root");
Statement stmt2 = conn.createStatement();
String sql2 = "Select count(*) from Enquirys";
ResultSet rs = stmt2.executeQuery(sql2);
rs.next();
int bno = rs.getInt(1) + 1;
Statement stmt = conn.createStatement();
String sql = "Insert into Enquirys values (" + bno + ", '" + DOEtxt.getText() + "', '" +
nameTF.getText() + "' , '" + AddressTF.getText() + "' , '" + gender + "' , " + age + " , '" +
PhoneTF.getText() + "' , '" + SchoolTF.getText() + "' )";
JOptionPane.showMessageDialog(null, sql);
stmt.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "Enquiry Number " + bno + " is inserted");
stmt.close();
stmt2.close();
conn.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Invalid Data" + e);
}
}
8/22/2019 Enquirys Project Documentation
29/36
private void loadBtnActionPerformed(java.awt.event.ActionEvent evt) {
String str = JOptionPane.showInputDialog("Enter Enquiry No.");
int n = Integer.parseInt(str);
try {
Class.forName("com.mysql.jdbc.Driver");
String database = "jdbc:mysql://localhost:3306/Enquirys";
Connection conn = DriverManager.getConnection(database, "root", "root");
Statement st = conn.createStatement();
String sql = "Select * from Enquirys where sno=" + n;
ResultSet rs = st.executeQuery(sql);
if (rs.next()) {
jTextField1.setText(rs.getString("sno"));
DOEtxt.setText(rs.getString("DOE"));
nameTF.setText(rs.getString("name"));
AddressTF.setText(rs.getString("addres"));
if (rs.getString("sex").equals("M")) {
MaleRB.setSelected(true);
} else {
FemaleRB.setSelected(true);
}
AgeTF.setText(rs.getString("age"));
PhoneTF.setText(rs.getString("phone"));
SchoolTF.setText(rs.getString("school"));
}
st.close();
conn.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Invalid Data" + e);
}
}
8/22/2019 Enquirys Project Documentation
30/36
private void updateBtnActionPerformed(java.awt.event.ActionEvent evt) {
char gender = 'M';
int n = Integer.parseInt(jTextField1.getText());
if (MaleRB.isSelected()) {
gender = 'M';
} else if (FemaleRB.isSelected()) {
gender = 'F';
}
int age = Integer.parseInt(AgeTF.getText());
try {
Class.forName("com.mysql.jdbc.Driver");
String database = "jdbc:mysql://localhost:3306/Enquirys";
Connection conn = DriverManager.getConnection(database, "root", "root");
Statement stmt2 = conn.createStatement();
String sql2 = "Delete from Enquirys where sno=" + n;
stmt2.execute(sql2);
Statement stmt = conn.createStatement();
String sql = "Insert into Enquirys values (" + n + ", '" + DOEtxt.getText() + "', '" +
nameTF.getText() + "' , '" + AddressTF.getText() + "' , '" + gender + "' , " + age + " , '" +
PhoneTF.getText() + "' , '" + SchoolTF.getText() + "' )";
JOptionPane.showMessageDialog(null, sql);
stmt.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "Enquiry Number " + n + " updated");
stmt.close();
stmt2.close();
conn.close();
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Invalid Data" + e);
}
}
8/22/2019 Enquirys Project Documentation
31/36
8/22/2019 Enquirys Project Documentation
32/36
void showEnquiries()
{
String query;DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Enquirys","root","root");
Statement st = con.createStatement();
String doe,sex;doe =(String) DOEComboBox.getSelectedItem();
sex =(String) SexComboBox.getSelectedItem();
while(jTable1.getRowCount()>0)
model.removeRow(jTable1.getRowCount()-1);
query = "Select * from Enquirys";
if(!doe.equals("ALL"))
query = query +" where DOE='"+doe+"'";
ResultSet rs = st.executeQuery(query);
while(rs.next())
{
String a = rs.getString(1);
String b = rs.getString(2);
String c = rs.getString(3);
String d = rs.getString(4);
String e = rs.getString(5);
String f = rs.getString(6);
8/22/2019 Enquirys Project Documentation
33/36
String g = rs.getString(7);
String h = rs.getString(8);
Object ob[] = {a,b,c,d,e,f,g,h};
model.addRow(ob);
}
rs.close();
st.close();
con.close();
}catch(Exception e)
{
JOptionPane.showMessageDialog(null,e);
}
}
private void showButtonActionPerformed(java.awt.event.ActionEvent evt) {
showEnquiries();
}
8/22/2019 Enquirys Project Documentation
34/36
private void formWindowGainedFocus(java.awt.event.WindowEvent evt) {
DOEComboBox.removeAllItems();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Enquirys","root","root");
Statement st = con.createStatement();
String query = "Select DISTINCT DOE from Enquirys";
ResultSet rs = st.executeQuery(query);
DOEComboBox.addItem("ALL");
while(rs.next())
{
DOEComboBox.addItem(rs.getString(1));
}
rs.close();
st.close();
con.close();
}catch(Exception e)
{
JOptionPane.showMessageDialog(null,e);
}
}
8/22/2019 Enquirys Project Documentation
35/36
Queries
create database Enquirys;
use Enquirys;
create table Login
(
ID varchar(20) primary key,
Password varchar(20)
)Engine=InnoDB;
insert into login values('CBSE',CBSE');insert into login values('kumar','kumar');
create Table Enquirys
(
Sno int primary key,
DOE date not null,
Name varchar(50),
Addres varchar(50),
Sex char(1),
Age int,
Phone varchar(20),
School varchar(20)
)Engine=InnoDB;
INSERT INTO ENQUIRYS VALUES (1,"2013-01-21","SRI RAM", "Visakhapatnam", "M", 16,
"9898598985","Tempany School");
INSERT INTO ENQUIRYS VALUES (2,"2013-01-21","SRI DEVI", "Visakhapatnam", "F", 16,
"9893598985","VISAKHA VALLEY");
8/22/2019 Enquirys Project Documentation
36/36
Bibliography
1. Google.com
2. W3schools.com
3. Sun.com
4. Mysql.com
5. Netbeans.org
Top Related