zoukankan      html  css  js  c++  java
  • 2020.12.7收获

    志愿者信息管理系统

    entity->Course.java

    package entity;
    
    public class Course {
    
        private int id;
        private String name;
        private String sex;
        private String minzu;
        private String time;
        private String age;
        private String mianmao;
        private String fuwu;
    
        public Course() {}
        
        public Course(int id, String name, String sex, String minzu,String time,String age,String mianmao,String fuwu) {
            this.setId(id);
            this.setName(name);
            this.setSex(sex);
            this.setMinzu(minzu);
            this.setTime(time);
            this.setAge(age);
            this.setMianmao(mianmao);
            this.setFuwu(fuwu);
        }
        
        public Course(String name, String sex, String minzu,String time,String age,String mianmao,String fuwu) {
            this.setName(name);
            this.setSex(sex);
            this.setMinzu(minzu);
            this.setTime(time);
            this.setAge(age);
            this.setMianmao(mianmao);
            this.setFuwu(fuwu);
        }
    
        public int getId() {
            return id;
        }
    
        public void setId(int id) {
            this.id = id;
        }
    
        public String getName() {
            return name;
        }
    
        public void setName(String name) {
            this.name = name;
        }
    
        public String getSex() {
            return sex;
        }
    
        public void setSex(String sex) {
            this.sex = sex;
        }
    
        public String getMinzu() {
            return minzu;
        }
    
        public void setMinzu(String minzu) {
            this.minzu = minzu;
        }
        public String getTime() {
            return time;
        }
    
        public void setTime(String time) {
            this.time = time;
        }
        public String getAge() {
            return age;
        }
    
        public void setAge(String age) {
            this.age = age;
        }
        public String getMianmao() {
            return mianmao;
        }
    
        public void setMianmao(String mianmao) {
            this.mianmao = mianmao;
        }
        public String getFuwu() {
            return fuwu;
        }
    
        public void setFuwu(String fuwu) {
            this.fuwu = fuwu;
        }
    }

    util->DBUtil.java

    package util;
    
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    
    
    public class DBUtil {
        
        public static String db_url = "jdbc:mysql://localhost:3306/trycurd?useSSL=false&characterEncoding=UTF-8";
        public static String db_user = "root";
        public static String db_pass = "20183641";
        
        public static Connection getConn () {
            Connection conn = null;
            
            try {
                Class.forName("com.mysql.jdbc.Driver");
                conn = DriverManager.getConnection(db_url, db_user, db_pass);
            } catch (Exception e) {
                e.printStackTrace();
            }
            
            return conn;
        }
        
        
        public static void close (Statement state, Connection conn) {
            if (state != null) {
                try {
                    state.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
        
        public static void close (ResultSet rs, Statement state, Connection conn) {
            if (rs != null) {
                try {
                    rs.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (state != null) {
                try {
                    state.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
            
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
    
    }
  • 相关阅读:
    leetcode 228. Summary Ranges ---------- java
    leetcode 227. Basic Calculator II ---------- java
    leetcode 225. Implement Stack using Queues 利用队列构建栈 ---------- java
    leetcode 224. Basic Calculator ---------- java
    leetcode 223. Rectangle Area 计算面积---------- java
    leetcode 222. Count Complete Tree Nodes 统计节点个数---------- java
    leetcode 链表题总结
    leetcode 221. Maximal Square 求一个数组中由1组成的最大的正方形面积 ---------- java
    React + Node 单页应用「三」API 设计 & 项目部署
    React + Node 单页应用「二」OAuth 2.0 授权认证 & GitHub 授权实践
  • 原文地址:https://www.cnblogs.com/ltw222/p/14171092.html
Copyright © 2011-2022 走看看