DBMS Mini Project Report
DBMS Mini Project Report
2021-2022
CERTIFICATE
MINI PROJECT ON
BY
Introduction:
➢ JDK 14.0.6 :
• The JDK is a development environment for building applications,
applets, and components using the Java programming language.
• To run this project JDK is necessary.
➢ Eclipse :
• Eclipse is an integrated development environment (IDE) used in
computer programming.its primary use is for developing Java
applications.
• This project is written in eclipse IDE and runs over it.
➢ MySQL :
• MySQL is an open sourcerelational database management system
based on SQL – Structured Query Language.
• MySQL database is necessary for running this project.
➢ MySQL Jconnector :
• MySQL provides connectivity for client applications developed in
the Java programming language with MySQL Connector/J, a driver
that implements the Java Database Connectivity (JDBC) API.
• For establishing connection between MySQL and java MySQL
connector is required.
ER Diagram:
Source Code:
import java.awt.EventQueue;
import javax.swing.JFrame;
import java.awt.Color;
import java.awt.CardLayout;
import com.jgoodies.forms.layout.FormLayout;
import com.jgoodies.forms.layout.ColumnSpec;
import com.jgoodies.forms.layout.RowSpec;
import net.proteanit.sql.DbUtils;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.awt.SystemColor;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.JScrollPane;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.ActionEvent;
import com.mysql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.*;
import java.sql.Statement;
import java.sql.SQLDataException;
public class JavaCrud {
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
JavaCrud window = new JavaCrud();
window.frmBookShop.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public JavaCrud() {
initialize();
Connect();
table_load();
}
Connection con;
PreparedStatement pat;
ResultSet rs;
String bname,edition,price;
bname = txtbname.getText();
edition = txtedition.getText();
price = txtprice.getText();
try {
pat = con.prepareStatement("insert into book(Name,Edition,Price)values(?,?,?)");
pat.setString(1, bname);
pat.setString(2, edition);
pat.setString(3, price);
pat.executeUpdate();
JOptionPane.showMessageDialog(null, "Record Addedddd!!!!!");
table_load();
txtbname.setText("");
txtedition.setText("");
txtprice.setText("");
txtbname.requestFocus();
}
e1.printStackTrace();
}
}});
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
btnExit.setBounds(173, 390, 92, 51);
frmBookShop.getContentPane().add(btnExit);
btnClear.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
txtbname.setText("");
txtedition.setText("");
txtprice.setText("");
txtbname.requestFocus();
}
});
btnClear.setBounds(312, 390, 92, 51);
frmBookShop.getContentPane().add(btnClear);
String id = txtbid.getText();
if(rs.next()==true)
{
txtbname.setText(name);
txtedition.setText(edition);
txtprice.setText(price);
}
else
{
txtbname.setText("");
txtedition.setText("");
txtprice.setText("");
}
}
catch (SQLException ex) {
}
}});
txtbname.setText("");
txtedition.setText("");
txtprice.setText("");
txtbname.requestFocus();
}
e1.printStackTrace();
}
}});
btnUpdate.setFont(new Font("Tahoma", Font.BOLD, 14));
btnUpdate.setBounds(476, 472, 128, 65);
frmBookShop.getContentPane().add(btnUpdate);
btnDelete.addActionListener(new ActionListener() {
String bid;
bid = txtbid.getText();
try {
pat = con.prepareStatement("delete from book where id =?");
pat.setString(1, bid);
pat.executeUpdate();
JOptionPane.showMessageDialog(null, "Record Delete!!!!!");
table_load();
txtbname.setText("");
txtedition.setText("");
txtprice.setText("");
txtbname.requestFocus();
}
e1.printStackTrace();
}
}});
Adding a Record:
Updating a Record:
Deleting a Record:
Conclusion:
The goal of Book Store management system is to offer more convenience and
more efficiency to access data from database.
Achievements :
➢ Database design.
➢ Understanding connectivity between java and MySQL.
➢ Performing CRUD operations.