资源简介

HelloWeb是运行在my eclipse8.6平台上,作为服务器端。 StudentManage是运行在eclipse android平台上的,作为客户端。 stumanager.sql是数据库文件,直接在mysql运行即可。

资源截图

代码片段和文件信息

package com.db;

import java.sql.*;

public class DBManager {

    // 数据库连接常量
    public static final String DRIVER = “com.mysql.jdbc.Driver“;
    public static final String USER = “root“;
    public static final String PASS = “123456“;
    public static final String URL = “jdbc:mysql://119.29.148.222:3306/stumanager“;

    // 静态成员,支持单态模式
    private static DBManager per = null;
    private Connection conn = null;
    private Statement stmt = null;

    // 单态模式-懒汉模式
    private DBManager() {
    }

    public static DBManager createInstance() {
        if (per == null) {
            per = new DBManager();
            per.initDB();
        }
        return per;
    }

    // 加载驱动
    public void initDB() {
        try {
            Class.forName(“com.mysql.jdbc.Driver“);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    // 连接数据库,获取句柄+对象
    public void connectDB() {
        System.out.println(“Connecting to database...“);
        try {
            conn = DriverManager.getConnection(URL USER PASS);
            stmt = conn.createStatement();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        System.out.println(“SqlManager:Connect to database successful.“);
    }

    // 关闭数据库 关闭对象,释放句柄
    public void closeDB() {
        System.out.println(“Close connection to database..“);
        try {
            stmt.close();
            conn.close();
        } catch (SQLException e) {
            e.printStackTrace();
        }
        System.out.println(“Close connection successful“);
    }

    // 查询
    public ResultSet executeQuery(String sql) {
        ResultSet rs = null;
        try {
            rs = stmt.executeQuery(sql);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return rs;
    }

    // 增添/删除/修改
    public int executeUpdate(String sql) {
        int ret = 0;
        try {
            ret = stmt.executeUpdate(sql);
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return ret;
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        475  2017-04-28 14:29  StudentManage\.classpath

     文件        849  2017-04-28 14:29  StudentManage\.project

     文件       3768  2017-06-01 14:11  StudentManage\AndroidManifest.xml

     文件       3768  2018-01-15 21:14  StudentManage\bin\AndroidManifest.xml

     文件       2737  2018-01-15 21:15  StudentManage\bin\classes\com\custom\arrary.class

     文件       1576  2018-01-15 21:15  StudentManage\bin\classes\com\custom\CreateUserDialog.class

     文件       1245  2018-01-15 21:15  StudentManage\bin\classes\com\custom\SegmentView$1.class

     文件       1245  2018-01-15 21:15  StudentManage\bin\classes\com\custom\SegmentView$2.class

     文件        284  2018-01-15 21:15  StudentManage\bin\classes\com\custom\SegmentView$onSegmentViewClickListener.class

     文件       4277  2018-01-15 21:15  StudentManage\bin\classes\com\custom\SegmentView.class

     文件        359  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\BuildConfig.class

     文件        361  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$attr.class

     文件        482  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$dimen.class

     文件       1097  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$drawable.class

     文件       2039  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$id.class

     文件        732  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$layout.class

     文件        409  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$menu.class

     文件        493  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$string.class

     文件        483  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R$style.class

     文件        743  2018-02-16 22:09  StudentManage\bin\classes\com\example\studentmanage\R.class

     文件        819  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$1.class

     文件       1616  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$10.class

     文件       1908  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$11.class

     文件        870  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$12.class

     文件       1914  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$13.class

     文件        870  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$14.class

     文件       1713  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$15.class

     文件       1537  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$16.class

     文件       1866  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$17.class

     文件        870  2018-01-15 21:15  StudentManage\bin\classes\com\kcat\studentmanage\Add_course$18.class

............此处省略314个文件信息

评论

共有 条评论