基于java+mysql的swing+mysql学生管理系统java基础gui(java+gui)
运行环境
Java≥8、MySQL≥5.7
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于java+mysql的Swing+MySQL学生管理系统java基础gui(java+gui)
功能介绍:
学生信息管理,姓名,编号,性别,成绩,学号住址
.addComponent(lblNewLabel_2)
.addComponent(passwordTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addComponent(userNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(36)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addContainerGap(60, Short.MAX_VALUE))
);
contentPane.setLayout(gl_contentPane);
// 设置JFrame居中显示
this.setLocationRelativeTo(null);
}
/**
* 登录事件处理
* @param e
*/
private void loginActionPerformed(ActionEvent evt) {
String userName=this.userNameTxt.getText();
String password=new String(this.passwordTxt.getPassword());
if(StringUtil.isEmpty(userName)){
JOptionPane.showMessageDialog(null, "用户名不能为空!");
return;
}
if(StringUtil.isEmpty(password)){
JOptionPane.showMessageDialog(null, "密码不能为空!");
return;
}
User user=new User(userName,password);
Connection con=null;
try {
con=dbUtil.getCon();
User currentUser=userDao.login(con, user);
if(currentUser!=null){
dispose();
new MainFrm().setVisible(true);
}else{
JOptionPane.showMessageDialog(null, "用户名或者密码错误!");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
if("search".equals(type)){
this.s_schoolClassJcb.addItem(schoolClass);
}else if("modify".equals(type)){
this.schoolClassJcb.addItem(schoolClass);
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/**
* 初始化表格数据
* @param book
*/
private void fillTable(Student book){
DefaultTableModel dtm=(DefaultTableModel) studentTable.getModel();
dtm.setRowCount(0); // 设置成0行
Connection con=null;
try{
con=dbUtil.getCon();
ResultSet rs=studentDao.list(con, book);
while(rs.next()){
Vector v=new Vector();
v.add(rs.getString("id"));
v.add(rs.getString("name"));
v.add(rs.getString("sn"));
v.add(rs.getString("sex"));
v.add(rs.getString("dept"));
v.add(rs.getString("address"));
v.add(rs.getString("className"));
dtm.addRow(v);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
this.fillTable(new Student());
}
/**
* 学生信息删除事件处理
* @param evt
*/
private void studentDeleteActionPerformed(ActionEvent evt) {
String id=idTxt.getText();
if(StringUtil.isEmpty(id)){
JOptionPane.showMessageDialog(null, "请选择要删除的记录");
return;
}
int n=JOptionPane.showConfirmDialog(null, "确定要删除该记录吗?");
if(n==0){
Connection con=null;
try{
con=dbUtil.getCon();
int deleteNum=studentDao.delete(con, id);
if(deleteNum==1){
JOptionPane.showMessageDialog(null, "删除成功");
this.resetValue();
this.fillTable(new Student());
}else{
JOptionPane.showMessageDialog(null, "删除失败");
}
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "删除失败");
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
public class LogOnFrm extends JFrame {
private JPanel contentPane;
private JTextField userNameTxt;
private JPasswordField passwordTxt;
private DbUtil dbUtil=new DbUtil();
private UserDao userDao=new UserDao();
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
LogOnFrm frame = new LogOnFrm();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public class SchoolClassManageInterFrm extends JInternalFrame {
private JTable schoolClassTable;
private JTextArea classDescTxt ;
private DbUtil dbUtil=new DbUtil();
private SchoolClassDao schoolClassDao=new SchoolClassDao();
private StudentDao studentDao=new StudentDao();
private JTextField s_classNameTxt;
private JTextField idTxt;
private JTextField classNameTxt;
/**
* Create the frame.
*/
public SchoolClassManageInterFrm() {
setClosable(true);
setIconifiable(true);
setTitle("班级信息管理界面");
setBounds(100, 100, 507, 481);
JScrollPane scrollPane = new JScrollPane();
JLabel label = new JLabel("班级信息名称");
s_classNameTxt = new JTextField();
s_classNameTxt.setColumns(10);
JButton button = new JButton("查询");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
schoolClassSearchActionPerformed(e);
}
});
button.setIcon(new ImageIcon(SchoolClassManageInterFrm.class.getResource("/images/search.png")));
JPanel panel = new JPanel();
panel.setBorder(new TitledBorder(null, "表单操作", TitledBorder.LEADING, TitledBorder.TOP, null, null));
GroupLayout groupLayout = new GroupLayout(getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.LEADING)
.addGroup(groupLayout.createSequentialGroup()
.addGap(42)
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addComponent(panel, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 401, Short.MAX_VALUE)
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
menuItem_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int result=JOptionPane.showConfirmDialog(null, "是否退出系统");
if(result==0){
dispose();
}
}
});
menuItem_4.setIcon(new ImageIcon(MainFrm.class.getResource("/images/exit.png")));
mnNewMenu.add(menuItem_4);
JMenu menu = new JMenu("关于系统");
menu.setIcon(new ImageIcon(MainFrm.class.getResource("/images/about.png")));
menuBar.add(menu);
JMenuItem mntmjava = new JMenuItem("关于");
mntmjava.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
ArtisanInterFrm java1234InterFrm=new ArtisanInterFrm();
java1234InterFrm.setVisible(true);
table.add(java1234InterFrm);
}
});
mntmjava.setIcon(new ImageIcon(MainFrm.class.getResource("/images/about.png")));
menu.add(mntmjava);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
table = new JDesktopPane();
contentPane.add(table, BorderLayout.CENTER);
// 设置JFrame最大化
this.setExtendedState(JFrame.MAXIMIZED_BOTH);
}
}
package com.artisan.dao;
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
JMenu mnNewMenu = new JMenu("基本数据维护");
mnNewMenu.setIcon(new ImageIcon(MainFrm.class.getResource("/images/base.png")));
menuBar.add(mnNewMenu);
JMenu mnNewMenu_1 = new JMenu("班级信息管理");
mnNewMenu_1.setIcon(new ImageIcon(MainFrm.class.getResource("/images/bookTypeManager.png")));
mnNewMenu.add(mnNewMenu_1);
JMenuItem menuItem = new JMenuItem("班级信息添加");
menuItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
SchoolClassAddInterFrm bookTypeAddInterFrm=new SchoolClassAddInterFrm();
bookTypeAddInterFrm.setVisible(true);
table.add(bookTypeAddInterFrm);
}
});
menuItem.setIcon(new ImageIcon(MainFrm.class.getResource("/images/add.png")));
mnNewMenu_1.add(menuItem);
JMenuItem menuItem_1 = new JMenuItem("班级信息整改");
menuItem_1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
SchoolClassManageInterFrm bookTypeManageInterFrm=new SchoolClassManageInterFrm();
bookTypeManageInterFrm.setVisible(true);
table.add(bookTypeManageInterFrm);
}
});
menuItem_1.setIcon(new ImageIcon(MainFrm.class.getResource("/images/edit.png")));
mnNewMenu_1.add(menuItem_1);
JMenu mnNewMenu_2 = new JMenu("学生信息管理");
mnNewMenu_2.setIcon(new ImageIcon(MainFrm.class.getResource("/images/bookManager.png")));
mnNewMenu.add(mnNewMenu_2);
JMenuItem menuItem_2 = new JMenuItem("学生信息添加");
menuItem_2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
StudentAddInterFrm bookAddInterFrm=new StudentAddInterFrm();
bookAddInterFrm.setVisible(true);
table.add(bookAddInterFrm);
}
});
menuItem_2.setIcon(new ImageIcon(MainFrm.class.getResource("/images/add.png")));
mnNewMenu_2.add(menuItem_2);
JMenuItem menuItem_3 = new JMenuItem("学生信息整改");
menuItem_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
StudentManageInterFrm bookManageInterFrm=new StudentManageInterFrm();
.addGroup(gl_panel.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel)
.addComponent(idTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_1)
.addComponent(classNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(gl_panel.createParallelGroup(Alignment.LEADING)
.addComponent(lblNewLabel_1)
.addComponent(classDescTxt, GroupLayout.PREFERRED_SIZE, 60, GroupLayout.PREFERRED_SIZE))
.addGap(18)
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
panel.setLayout(gl_panel);
schoolClassTable = new JTable();
schoolClassTable.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
schoolClassTableMousePressed(e);
}
});
schoolClassTable.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"\u7F16\u53F7", "班级信息名称", "班级信息描述"
}
) {
boolean[] columnEditables = new boolean[] {
false, false, false
};
public boolean isCellEditable(int row, int column) {
return columnEditables[column];
}
});
schoolClassTable.getColumnModel().getColumn(1).setPreferredWidth(110);
schoolClassTable.getColumnModel().getColumn(2).setPreferredWidth(123);
scrollPane.setViewportView(schoolClassTable);
getContentPane().setLayout(groupLayout);
this.fillTable(new SchoolClass());
);
getContentPane().setLayout(groupLayout);
}
}
package com.artisan.model;
/**
* 班级实体
*/
public class SchoolClass {
private int id; // 编号
private String className; // 班级名称
private String calssDesc; // 备注
public SchoolClass() {
super();
// TODO Auto-generated constructor stub
}
public SchoolClass(String className, String calssDesc) {
super();
this.className = className;
this.calssDesc = calssDesc;
}
public SchoolClass(int id, String className, String calssDesc) {
super();
this.id = id;
this.className = className;
this.calssDesc = calssDesc;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getClassName() {
return className;
.addGap(18)
.addComponent(button)
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
gl_panel.setVerticalGroup(
gl_panel.createParallelGroup(Alignment.TRAILING)
.addGroup(gl_panel.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(gl_panel.createParallelGroup(Alignment.BASELINE)
.addComponent(label)
.addComponent(s_nameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_1)
.addComponent(s_snTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(label_2)
.addComponent(s_schoolClassJcb, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addComponent(button))
.addGap(16))
);
panel.setLayout(gl_panel);
studentTable = new JTable();
studentTable.addMouseListener(new MouseAdapter() {
@Override
public void mousePressed(MouseEvent met) {
studentTableMousePressed(met);
}
});
scrollPane.setViewportView(studentTable);
studentTable.setModel(new DefaultTableModel(
new Object[][] {
},
new String[] {
"\u7F16\u53F7", "学生姓名", "学生学号", "学生性别", "成绩分数", "家庭住址", "所属班级"
}
) {
boolean[] columnEditables = new boolean[] {
false, false, false, false, false, false, false
};
public boolean isCellEditable(int row, int column) {
return columnEditables[column];
menuItem_2.setIcon(new ImageIcon(MainFrm.class.getResource("/images/add.png")));
mnNewMenu_2.add(menuItem_2);
JMenuItem menuItem_3 = new JMenuItem("学生信息整改");
menuItem_3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
StudentManageInterFrm bookManageInterFrm=new StudentManageInterFrm();
bookManageInterFrm.setVisible(true);
table.add(bookManageInterFrm);
}
});
menuItem_3.setIcon(new ImageIcon(MainFrm.class.getResource("/images/edit.png")));
mnNewMenu_2.add(menuItem_3);
JMenuItem menuItem_4 = new JMenuItem("安全退出");
menuItem_4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
int result=JOptionPane.showConfirmDialog(null, "是否退出系统");
if(result==0){
dispose();
}
}
});
menuItem_4.setIcon(new ImageIcon(MainFrm.class.getResource("/images/exit.png")));
mnNewMenu.add(menuItem_4);
JMenu menu = new JMenu("关于系统");
menu.setIcon(new ImageIcon(MainFrm.class.getResource("/images/about.png")));
menuBar.add(menu);
JMenuItem mntmjava = new JMenuItem("关于");
mntmjava.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
ArtisanInterFrm java1234InterFrm=new ArtisanInterFrm();
java1234InterFrm.setVisible(true);
table.add(java1234InterFrm);
}
});
mntmjava.setIcon(new ImageIcon(MainFrm.class.getResource("/images/about.png")));
menu.add(mntmjava);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
table = new JDesktopPane();
JOptionPane.showMessageDialog(null, "学生信息名称不能为空!");
return;
}
if(StringUtil.isEmpty(sn)){
JOptionPane.showMessageDialog(null, "学生信息作者不能为空!");
return;
}
if(StringUtil.isEmpty(dept)){
JOptionPane.showMessageDialog(null, "学生信息价格不能为空!");
return;
}
String sex="";
if(manJrb.isSelected()){
sex="男";
}else if(femaleJrb.isSelected()){
sex="女";
}
SchoolClass schoolClassTmp=(SchoolClass) schoolClassJcb.getSelectedItem();
int scId=schoolClassTmp.getId();
Student book=new Student(Integer.parseInt(id), sname, sn, sex, dept, scId, address);
Connection con=null;
try{
con=dbUtil.getCon();
int addNum=studentDao.update(con, book);
if(addNum==1){
JOptionPane.showMessageDialog(null, "学生信息修改成功!");
resetValue();
this.fillTable(new Student());
}else{
JOptionPane.showMessageDialog(null, "学生信息修改失败!");
}
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "学生信息修改失败!");
.addComponent(passwordTxt)
.addComponent(userNameTxt, GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)))))
.addContainerGap(111, Short.MAX_VALUE))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(30)
.addComponent(lblNewLabel)
.addGap(26)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(lblNewLabel_1)
.addGap(29)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNewLabel_2)
.addComponent(passwordTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
.addComponent(userNameTxt, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(36)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(btnNewButton)
.addComponent(btnNewButton_1))
.addContainerGap(60, Short.MAX_VALUE))
);
contentPane.setLayout(gl_contentPane);
// 设置JFrame居中显示
this.setLocationRelativeTo(null);
}
/**
* 登录事件处理
* @param e
*/
private void loginActionPerformed(ActionEvent evt) {
String userName=this.userNameTxt.getText();
String password=new String(this.passwordTxt.getPassword());
if(StringUtil.isEmpty(userName)){
JOptionPane.showMessageDialog(null, "用户名不能为空!");
return;
}
if(StringUtil.isEmpty(password)){
JOptionPane.showMessageDialog(null, "密码不能为空!");
return;
}
/**
* 数据库工具类
*
*/
public class DbUtil {
private String jdbcName = "com.mysql.jdbc.Driver"; // 驱动名称
private String dbUrl = "jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull"; // 数据库连接地址
private String dbUserName = "root"; // 用户名,填写你自己的数据库用户名
private String dbPassword = "123456"; // 密码,你自己的用户名密码,这个就是我的,所以我不修改了
/**
* 获取数据库连接
*
* @return
* @throws Exception
*/
public Connection getCon() throws Exception {
Class.forName(jdbcName);
Connection con = DriverManager.getConnection(dbUrl, dbUserName, dbPassword);
return con;
}
/**
* 关闭数据库连接
*
* @param con
* @throws Exception
*/
public void closeCon(Connection con) throws Exception {
if (con != null) {
con.close();
}
}
public static void main(String[] args) {
DbUtil dbUtil = new DbUtil();
try {
dbUtil.getCon();
System.out.println("数据库连接成功!");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("数据库连接失败");
}
}
}
package com.artisan.view;
/**
* 查询班级集合
* @param con
* @param schoolClass
* @return
* @throws Exception
*/
public ResultSet list(Connection con,SchoolClass schoolClass)throws Exception{
StringBuffer sb=new StringBuffer("select * from t_school_class");
if(StringUtil.isNotEmpty(schoolClass.getClassName())){
sb.append(" and className like '%"+schoolClass.getClassName()+"%'");
}
PreparedStatement pstmt=con.prepareStatement(sb.toString().replaceFirst("and", "where"));
return pstmt.executeQuery();
}
/**
* 删除班级
* @param con
* @param id
* @return
* @throws Exception
*/
public int delete(Connection con,String id)throws Exception{
String sql="delete from t_school_class where id=?";
PreparedStatement pstmt=con.prepareStatement(sql);
pstmt.setString(1, id);
return pstmt.executeUpdate();
}
/**
* 更新班级
* @param con
* @param schoolClass
* @return
* @throws Exception
*/
public int update(Connection con,SchoolClass schoolClass)throws Exception{
String sql="update t_school_class set className=?,classDesc=? where id=?";
dtm.setRowCount(0); // 设置成0行
Connection con=null;
try{
con=dbUtil.getCon();
ResultSet rs=studentDao.list(con, book);
while(rs.next()){
Vector v=new Vector();
v.add(rs.getString("id"));
v.add(rs.getString("name"));
v.add(rs.getString("sn"));
v.add(rs.getString("sex"));
v.add(rs.getString("dept"));
v.add(rs.getString("address"));
v.add(rs.getString("className"));
dtm.addRow(v);
}
}catch(Exception e){
e.printStackTrace();
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
package com.artisan.view;
this.fillBookType("modify");
this.fillTable(new Student());
}
/**
* 学生信息删除事件处理
* @param evt
*/
private void studentDeleteActionPerformed(ActionEvent evt) {
String id=idTxt.getText();
if(StringUtil.isEmpty(id)){
JOptionPane.showMessageDialog(null, "请选择要删除的记录");
return;
}
int n=JOptionPane.showConfirmDialog(null, "确定要删除该记录吗?");
if(n==0){
Connection con=null;
try{
con=dbUtil.getCon();
int deleteNum=studentDao.delete(con, id);
if(deleteNum==1){
JOptionPane.showMessageDialog(null, "删除成功");
this.resetValue();
this.fillTable(new Student());
}else{
JOptionPane.showMessageDialog(null, "删除失败");
}
}catch(Exception e){
e.printStackTrace();
JOptionPane.showMessageDialog(null, "删除失败");
}finally{
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
/**
* 学生信息修改事件处理
* @param evt
}
public void setAddress(String address) {
this.address = address;
}
}
package com.artisan.util;
/**
* 数据库工具类
*
*/
public class DbUtil {
private String jdbcName = "com.mysql.jdbc.Driver"; // 驱动名称
private String dbUrl = "jdbc:mysql://localhost:3306/project?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull"; // 数据库连接地址
private String dbUserName = "root"; // 用户名,填写你自己的数据库用户名
private String dbPassword = "123456"; // 密码,你自己的用户名密码,这个就是我的,所以我不修改了
/**
* 获取数据库连接
*
* @return
* @throws Exception
*/
public Connection getCon() throws Exception {
Class.forName(jdbcName);
Connection con = DriverManager.getConnection(dbUrl, dbUserName, dbPassword);
return con;
}