Project On Mysql
Project On Mysql
2. System 3
Implementation
3. System Design 4
& Development
5. Output 57
Screens
6. Future 66
Updations
7. User Manual 67
8. References 68
1
1. Introduction
(MIS) to automate the record keeping of various CDs including those of music,
softwares and movies with a view to enhance the decision making of the
functionaries.
relevant to the user. An application program is tied with the database for easy
This software, being simple in design and working, does not require much of
training to users, and can be used as a powerful tool for automating aCD Library
System.
During coding and design of the software Project, Java NetBeans IDE, a powerful
front-end tool is used for getting Graphical User Interface (GUI) based integrated
Course.
2
2. System Implementation
3
3. System Design & Development
JSS Infoware gateway comprises the following options, organized in a user friendly way. The menu system
divided in Menu Bars, each having a pull down menus containing options for a specific task.
4
3.3Data Structures
1.TABLE EMP:-
2.TABLE ELOGIN_INFO:-
3.TABLE LIB:-
5
4.TABLE LOGIN_INFO:-
5.TABLE MEMBER:-
6.TABLE MISSUE:-
6
7.TABLE TISSUE:-
8.TABLE PUBLISHER:-
7
4. Forms Design & Event Coding:
The software project for PUTUMAYO WORLD MUSIC contains various forms along with programming
codes. Forms (JFrames) and their event coding are given below.
Frame: f1.java
8
}
9
Frame: delete.java
Coding of delete.java
Statement stmt = null;
ResultSet rs = null;
String SQL = "SELECT * FROM Lib";
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
if (Ano.length() < 4)
{
int x = Ano.length();
int nl = 4 - x;
while (nl > 0){
Ano = Ano + " ";
nl--;
}
}
dModel.addElement(Ano + "- " + BTitle);
}
jList1.setModel(dModel);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage());
12
e.printStackTrace();
} // TODO add your handling code here:
}
Frame: Return.java
// Extrating the Acc_no from Tissue table to find book details in Lib table
String query1 = "SELECT * FROM Tissue WHERE memb_no = " + (Mno) + ";";
// Create SQL statement and execute query.
stmt3 = con.createStatement();
rs3 = stmt3.executeQuery(query1);
int ACno = 0;
if (rs3.next()) {
ACno = rs3.getInt("acc_no");
txtAcno.setText(String.valueOf(ACno));
}
// Extrating the Library details for Acc_no from Lib table
String query2 = "SELECT * FROM Lib WHERE acc_no = " + (ACno) + ";";
// Create SQL statement and execute query.
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(query2);
String BTitle, Auth;
if (rs1.next()) {
BTitle = rs1.getString("btitle");
Auth = rs1.getString("author1");
txtBTitle.setText(BTitle);
txtAuth.setText(Auth);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
// method operations
DefaultListModel dModel = (DefaultListModel) jList1.getModel();
// Method to add elements into jList1 control for member
dModel.clear();
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/Library","root","kvuc");
15
// Listing Members
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
String Mno = rs.getString("memb_no");
String MName = rs.getString("memb_name");
// To make the Member no. as 4 digit because we will extract 4 digit from list value
// in mouse click event.
if (Mno.length() < 4)
{
int x = Mno.length();
int nl = 4 - x;
while (nl > 0){
Mno = Mno + " ";
nl--;
}
}
dModel.addElement(Mno + "- " + MName);
}
jList1.setModel(dModel);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
} // TODO add your handling code here:
}
Frame: aboutus.java
16
Coding for aboutus.Java
private void exitActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
// TODO add your handling code here:
}
17
Frame: addemployee.java
Coding of addemployee.java
public class addemployee extends javax.swing.JFrame {
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
String DB="jdbc:mysql://localhost/board_project";
/** Creates new form addemployee */
public addemployee() {
initComponents();
18
t3 = new javax.swing.JTextField();
t4 = new javax.swing.JTextField();
save = new javax.swing.JButton();
reset = new javax.swing.JButton();
exit = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Add Employee");
t1.setToolTipText("emp code");
t2.setToolTipText("name");
t3.setToolTipText("address");
t4.setToolTipText("contact no.");
t4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
t4ActionPerformed(evt);
}
});
pack();
}// </editor-fold>
21
private void t4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new addemployee().setVisible(true);
}});
22
Frame: albumslist.java
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Available Albums");
},
new String [] {
"NAME", "ADDRESS", "DATE OF JOINING", "CONTACT NO."
}
){
Class[] types = new Class [] {
java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class
};
pack();
}// </editor-fold>
Frame: deal.java
25
Coding for deal.java
private void issueActionPerformed(java.awt.event.ActionEvent evt) {
new issue().setVisible(true); // TODO add your handling code here:
}
Frame: delete.java
26
Coding of delete.Java
private void deleteActionPerformed(java.awt.event.ActionEvent evt) {
try {
Class.forName("com.mysql.jdbc.Driver");
String DB="jdbc:mysql://localhost/board_project";
Connection con=DriverManager.getConnection(DB,"root","kvuc");
Statement stmt=con.createStatement();
ResultSet rs =stmt.executeQuery("select * from emp;" );
String empcode = dt1.getText();
int opt = JOptionPane.showConfirmDialog(null, "Are you sure to delete this record ?");
if (opt == JOptionPane.YES_OPTION)
{
try {
String strSQL = "Delete from emp where emp_code = '"+(empcode)+"';";
int rowsEffected = stmt.executeUpdate(strSQL);
if (rowsEffected == 0)
JOptionPane.showMessageDialog(this, "Record does not exists");
else
{
JOptionPane.showMessageDialog(this,"Record Deleted");
dt1.setText("");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Unable to delete");
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
} // TODO add your handling code here:
}
27
private void cancel2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose(); // TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new delete().setVisible(true);
}
});
}
Frame: developer.java
Frame: edit.java
28
Coding for edit.java
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Edit Record");
addWindowFocusListener(new java.awt.event.WindowFocusListener() {
public void windowGainedFocus(java.awt.event.WindowEvent evt) {
formWindowGainedFocus(evt);
}
public void windowLostFocus(java.awt.event.WindowEvent evt) {
}
});
29
jList1.setModel(new DefaultListModel());
jList1.setToolTipText("select disk...");
jList1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
jList1MouseClicked(evt);
}
});
jScrollPane1.setViewportView(jList1);
txtPID.setToolTipText("production id...");
jComboBox1.setModel(new DefaultComboBoxModel() );
jComboBox1.setToolTipText("select producer");
txtPrice.setToolTipText("price");
30
txtEdition.setToolTipText("edition");
txtBTitle.setToolTipText("title");
txtAcno.setToolTipText("disk id..");
txtStatus.setToolTipText("status");
txtAuth1.setToolTipText("director's name");
pack();
}// </editor-fold>
Statement stmt1 = null;
ResultSet rs1 = null;
String SQL1 = "SELECT * FROM publisher";
Statement stmt = null;
ResultSet rs = null;
String SQL = "SELECT * FROM Lib";
String strSQL = "Update Lib set btitle ='"+(bTitle)+"', author1 = '"+(Auth1)+"', author2 = '"+(Auth2)+"', pub_id = "+
(PID)+", price = "+(Price)+", pdate = '"+(Pdate)+"', edition = "+(edition)+", status = '"+(BStatus)+"' where acc_no = "
+ (Acno);
int rowsEffected = stmt.executeUpdate(strSQL);
if (rowsEffected == 0)
JOptionPane.showMessageDialog(this, "Record does not exists");
else
JOptionPane.showMessageDialog(this,"Record modified");
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
if (Ano.length() < 4)
{
int x = Ano.length();
int nl = 4 - x;
while (nl > 0){
Ano = Ano + " ";
nl--;
35
}
}
dModel.addElement(Ano + "- " + BTitle);
}
jList1.setModel(dModel);
// To list the publisher id and name into JComboBox1.
DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel();
cModel.removeAllElements();
stmt1 = con.createStatement(); // To list publishers in JComboBox1 component
rs1 = stmt1.executeQuery(SQL1);
while (rs1.next()) {
String pubno = rs1.getString("pub_id");
String pubName = rs1.getString("pub_name");
// To make the publisher no. as 4 digit because we will extract 4 digit from list value
// in mouse click event
txtStatus.setText("Y"); // Because it is a new book, when it will be issue,
// it's status will be N.
if (pubno.length() < 4)
{
int x = pubno.length();
int nl = 4 - x;
while (nl > 0){
pubno = pubno + " ";
nl--;
}
}
cModel.addElement(pubno + "- " + pubName);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
} // TODO add your handling code here: }
Frame: employee_details.java
36
Coding for employee_details.Java
37
{ JOptionPane.showMessageDialog(null, e.getMessage() ); } // TODO add your handling code here:
}
Frame: illist.java
38
Coding for illist.java
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
39
String acc = rs.getString("acc_no");
String bTitle = rs.getString("btitle");
String Auth = rs.getString("author1");
String Price = rs.getString("price");
String edition = rs.getString("edition");
//System.out.println(Acno + "|" + bTitle + "|" + Auth1 + "|" + Price + "|" + edition);
model.addRow(new Object[] {acc, bTitle, Auth, Price, edition});
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
} // TODO add your handling code here:
}
Frame: issue.java
40
Coding for issue.java
Statement stmt = null;
ResultSet rs = null;
char st1 = 'N';
char ms = 'Y';
String SQL = "SELECT * FROM Member WHERE mem_issue = '" + st1 + "' and mem_status ='" + ms +
"'";
if (rs.next()) {
String MName = rs.getString("memb_name");
String MDate = rs.getString("mdate");
String MStatus = rs.getString("mem_status");
// Displaying the contents in respective text boxes.
txtMNo.setText(Mno);
txtMName.setText(MName);
txtMDate.setText(MDate);
txtMStatus.setText(MStatus);
} else {
JOptionPane.showMessageDialog(null, "Record does not found in Member table");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
// Tissue table
stmt3 = con.createStatement();
rs3 = stmt.executeQuery(SQL);
int Acno = Integer.parseInt(txtAcno.getText().trim());
int Mno = Integer.parseInt(txtMNo.getText().trim());
String idt = txtIDate.getText();
String rdt = idt; // Temporarily assigned for testing purpose
int code = JOptionPane.showConfirmDialog(this, "Are you sure to add?", "Confirmation Dialog Box",
JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.INFORMATION_MESSAGE);
if (code == JOptionPane.YES_OPTION) {
// Record updated into Missue and Tissue tables
43
String strSQL = "INSERT INTO Missue(acc_no, memb_no, idate, rdate) VALUES ("+(Acno)+", "+(Mno)
+", '"+(idt)+"', '"+(rdt)+"')";
String strSQL1 = "INSERT INTO Tissue(acc_no, memb_no, idate, rdate) VALUES ("+(Acno)+", "+(Mno)
+", '"+(idt)+"', '"+(rdt)+"')";
stmt2.executeUpdate(strSQL);
stmt3.executeUpdate(strSQL1);
try {
Class.forName("com.mysql.jdbc.Driver");
44
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/board_project","root","kvuc");
// Listing Members
stmt = con.createStatement();
rs = stmt.executeQuery(SQL);
while (rs.next()) {
String Mno = rs.getString("memb_no");
String MName = rs.getString("memb_name");
// To make the Member no. as 4 digit because we will extract 4 digit from list value
// in mouse click event.
if (Mno.length() < 4)
{
int x = Mno.length();
int nl = 4 - x;
while (nl > 0){
Mno = Mno + " ";
nl--;
}
}
dModel.addElement(Mno + "- " + MName);
}
jList1.setModel(dModel);
// Listing books
stmt1 = con.createStatement();
rs1 = stmt1.executeQuery(SQL1);
while (rs1.next()) {
String Ano = rs1.getString("acc_no");
String BTitle = rs1.getString("btitle");
// To make the Accession no. as 4 digit because we will extract 4 digit from list value
// in mouse click event.
if (Ano.length() < 4)
{
int x = Ano.length();
int nl = 4 - x;
45
while (nl > 0){
Ano = Ano + " ";
nl--;
}
}
cModel.addElement(Ano + "- " + BTitle);
}
jList2.setModel(cModel);
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}// TODO add your handling code here:
}
Frame: libui.java
46
Coding for libui.java
Statement stmt = null;
ResultSet rs = null;
String SQL = "SELECT * FROM Lib";
// for table Publisher
Statement stmt1 = null;
ResultSet rs1 = null;
String SQL1 = "SELECT * FROM publisher";
private void cmdNewActionPerformed(java.awt.event.ActionEvent evt) {
// Activate the Save button when New button pressed
cmdSave.setEnabled(true);
DefaultComboBoxModel cModel = (DefaultComboBoxModel) jComboBox1.getModel();
cModel.removeAllElements();
txtStatus.setEditable(false);
// Activate the Save button when New button clicked
cmdSave.setEnabled(true);
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/board_project","root","kvuc");
47
rs1 = stmt1.executeQuery(SQL1);
while (rs1.next()) {
String pubno = rs1.getString("pub_id");
String pubName = rs1.getString("pub_name");
// To make the publisher no. as 4 digit because we will extract 4 digit from list value
// in mouse click event
txtStatus.setText("Y"); // Because it is a new book, when it will be issue,
// it's status will be N.
if (pubno.length() < 4) {
int x = pubno.length();
int nl = 4 - x;
while (nl > 0){
pubno = pubno + " ";
nl--;
}
}
cModel.addElement(pubno + "- " + pubName);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this,e.getMessage());
e.printStackTrace();
}
}
48
JOptionPane.showMessageDialog(this, "Record added successfully into Lib table");
}
cmdSave.setEnabled(false);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
49
Frame: login.java
}
else
JOptionPane.showMessageDialog(this,"Invalid user name , password");
lt1.setText("");
lp1.setText("");
rs.close();
stmt.close();
con.close();
}
catch (Exception e)
{ JOptionPane.showMessageDialog(null, e.getMessage()+"error in connection" ); }
}
50
else
if(rdemployee.isSelected()){
String usrid1 = lt1.getText();
try{
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/board_project","root","kvuc");
stmt = con.createStatement();
rs = stmt.executeQuery("select password from elogin_info where username ='"+usrid1+"';" );
}
else
JOptionPane.showMessageDialog(this,"Invalid user name , password");
lt1.setText("");
lp1.setText("");
rs.close();
stmt.close();
con.close();
}
catch (Exception e)
{ JOptionPane.showMessageDialog(null, e.getMessage()+"error in connection" ); }
}// TODO add your handling code here:
}
Frame: mlist.java
51
Code for mlist.java
private void cmdExitActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
Frame: movieslist.java
Frame: pcgameslist.java
5.Output Screen
Main Frame :
55
1. On Clicking Login Button :
56
3. Display Records
57
5.Remove record
Output Screen
Main Frame :
58
3. Display Records
5. Remove Record
6. Employee Login
59
7. Issue Button :
8. Return Disc :
60
9.Console Button :
10. Delete :
61
On clicking the Exit Button and then Back Button we get redirected to main Frame
Movies :
62
Albums :
PC Games :
63
11. About Us
About Developer
64
6.Future Updations
internet so that all the members and other people who wants
to associate with the store can be updated about the new cd’s
electronic devices.
7. User Manual
65
Standard I/O devices like Keyboard and Mouse etc.
Printer is needed for hard-copy reports.
Local Area Network(LAN) is required for Client-Server Installation
Software Requirement-
Windows 7 OS is desirable.
NetBeans Ver 6.5.1 or higher should be installed with JDK and JVM.
MySQL Ver 6.1 with Library Database must be present at machine.
Database Installation
The software project is distributed with a backup copy of a Database named board_project with required
tables. Some dummy records are present in the tables for testing purposes, which can be deleted before
inserting real data. The project is shipped with board_project.sql file which installs a database and tables in
the computer system.
Note: The PC must have MySQL server with user (root) and password ( )ie(spacebar . If root password is
any other password, it can be changed by running MySQL Server Instance Configure Wizard.
Start Program MySQL MySQL Server MySQL Server Instance Config Wizard
Provide current password of root and new password as “ ” , this will change the root password.
To install a MySQL database from a dump file ( board_project.sql) , simply follow the following steps.
Step 1: Copy the board_project.sql file in C:\Program files\Mysql\MySql server 6.1\Bin folder.
Step 2: Open MySQL and type the following command to create the dabase named Library.
mysql> create database board_project;
Step 3: Open Command Window (Start Run cmd)
Step 4: Go to the following folder using CD command of DOS.
C:\Program files\Mysql\MySql server 6.1\Bin>
Step 5: type the following command on above prompt -
C:….\bin> mysql -u root -p board_project < board_project.sql
This will create a board_project databse with required tables.
8. References
In order to work on this project titled -PUTUMAYO , the following books and literature are refered by us
during the various phases of development of the project.
(4) http://www.netbeans.org/
Other than the above-mentioned books, the suggestions and supervision of my teacher and my class
experience also helped us to develop this software project.
67