蓄电池监控管理平台数据库初始化程序
在web_site添加部分表的创建语句,并且在tb_batt_rtstate表中添加2列用于主程序的在重启后的继续存储历史放电数据
5个文件已修改
317 ■■■■■ 已修改文件
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java 254 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
BattMonitor_DB_Builder/bin/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.class
Binary files differ
BattMonitor_DB_Builder/bin/com/sql/Sql_Mysql.class
Binary files differ
BattMonitor_DB_Builder/src/com/battdata_rt/BattData_RT_RamDB_Thread_SQL.java
@@ -39,14 +39,32 @@
                        + "ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        ResultSet res = null;
        try {
            if(true == recreate) {
                sql.sqlMysqlExecute(sql_str0);                    //删除tb_batt_rtdata
                sql.sqlMysqlExecute(sql_str1);                    //不存在  tb_batt_rtdata表的时候重新建表
            } else {
                //sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BattRtData_Table);        //删除tb_batt_rtdata
            }
            sql.sqlMysqlExecute(sql_str1);                    //不存在  tb_batt_rtdata表的时候重新建表
            //添加单体容量列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_batt_rtdata'"
                    + " AND column_name='mon_cap'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table
                                + " ADD COLUMN `mon_cap` FLOAT NOT NULL DEFAULT 0;");
            }
            //添加单体容量列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_batt_rtdata'"
                    + " AND column_name='mon_JH_curr'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table
                                + " ADD COLUMN `mon_JH_curr` FLOAT NOT NULL DEFAULT 0;");
            }
            ResultSet res_t = sql.sqlMysqlQuery("SELECT BattGroupId,MonCount FROM " + Sql_Mysql.BattInf_Table);
            while(res_t.next()) {
                int bg_id = res_t.getInt("BattGroupId");
@@ -141,22 +159,44 @@
                        + "`batt_rest_cap` FLOAT NOT NULL DEFAULT 0, "
                        + "`batt_rest_power1_time` INT NOT NULL DEFAULT 0, "
                        + "`batt_rest_power2_time` INT NOT NULL DEFAULT 0, "
                        + "`test_loadertype` INT NOT NULL DEFAULT 0,"
                        + "`test_recordnum` INT NOT NULL DEFAULT 0,"
                        + "INDEX index_BattGroupId (`BattGroupId`), "
                        + "PRIMARY KEY (`num`)) "
                        + "ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        
        String sql_str2 = "INSERT INTO " + Sql_Mysql.BattRtState_Table + "(BattGroupId)"
                            + " SELECT BattGroupId FROM " + Sql_Mysql.BattInf_Table;
        //String sql_str2 = "INSERT INTO " + Sql_Mysql.BattRtState_Table + "(BattGroupId)" + " SELECT BattGroupId FROM " + Sql_Mysql.BattInf_Table;
        //添加未录入电池组的组端信息
        String sql_str2 = "INSERT INTO " + Sql_Mysql.BattRtState_Table + " (BattGroupId)" +
                " SELECT BattGroupId FROM " + Sql_Mysql.BattInf_Table +
                " WHERE BattGroupId NOT IN (SELECT BattGroupId FROM " + Sql_Mysql.BattRtState_Table + ")";
        Sql_Mysql sql = new Sql_Mysql(conn_pool.getConn());
        ResultSet res = null;
        try {
            if(true == recreate) {
                sql.sqlMysqlExecute(sql_str0);
                sql.sqlMysqlExecute(sql_str1);
            } else {
                sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BattRtState_Table);
                //sql.sqlMysqlExecute("DELETE FROM " + Sql_Mysql.BattRtState_Table);
            }
            //添加当前测试类型列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_batt_rtstate'"
                    + " AND column_name='test_loadertype'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table
                                + " ADD COLUMN `test_loadertype` INT NOT NULL DEFAULT 0;");
            }
            //添加记录笔数
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='db_ram_db'"
                    + " AND table_name='tb_batt_rtstate'"
                    + " AND column_name='test_recordnum'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.BattRtState_Table
                                + " ADD COLUMN `test_recordnum` INT NOT NULL DEFAULT 0;");
            }
            sql.sqlMysqlExecute(sql_str2);
        } catch (SQLException e) {
            // TODO Auto-generated catch block
BattMonitor_DB_Builder/src/com/database_util/DB_web_site.java
@@ -13,8 +13,17 @@
        createWeb_siteDB(pool);                                        //创建website 数据库
        
        createThread_utilTable(pool,recreate);                        //创建线程控制表
        createPositiomapUsr_Table(pool,recreate);                    //创建首页上用户中心点设置表
        createChartColor_Table(pool,recreate);                        //创建用户实时监测页面柱体颜色设置表
        createUserChart_Table(pool,recreate);                        //创建班组管理表
        createProcessSurvey_Table(pool,recreate);                    //创建线程监控表
    }
    
    //创建 web_site 数据库
    public static void createWeb_siteDB(MysqlConnPool pool) {
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
@@ -26,6 +35,9 @@
        }
    }
    
    /**
     * 创建线程手动启动工具表
     */
    public static void createThread_utilTable(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ThreadUtil_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ThreadUtil_Table + " (" + 
@@ -61,6 +73,248 @@
        }
    }
    
    /**
     * 创建用户地图中心点位置表
     */
    public static void createPositiomapUsr_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.PositiomapUsr_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.PositiomapUsr_Table + " (" +
                "  `num` int(11) NOT NULL AUTO_INCREMENT," +
                "  `map_longitude` float NOT NULL DEFAULT '116.405'," +
                "  `map_latitude` float NOT NULL DEFAULT '39.9149'," +
                "  `map_level` int(11) NOT NULL DEFAULT '10'," +
                "  `uid` int(11) NOT NULL DEFAULT '1002'," +
                "  `note` varchar(64) NOT NULL DEFAULT '保留'," +
                "  PRIMARY KEY (`num`)," +
                "  UNIQUE KEY `index_uid` (`uid`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            if(true == recreate) {
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建用户实时监测页面柱体颜色设置表
     */
    public static void createChartColor_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ChartColor_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ChartColor_Table + " (" +
                " `num` int(11) NOT NULL AUTO_INCREMENT," +
                "  `uid` int(11) NOT NULL DEFAULT '1001'," +
                "  `max_color` varchar(64) NOT NULL DEFAULT 'red'," +
                "  `min_color` varchar(64) NOT NULL DEFAULT 'green'," +
                "  `normal_color` varchar(64) NOT NULL DEFAULT '#5986BF'," +
                "  `change_color` varchar(64) NOT NULL DEFAULT '#BFA0D1'," +
                "  `warn_color` varchar(64) NOT NULL DEFAULT '#ffff00'," +
                "  `note` varchar(64) NOT NULL DEFAULT ''," +
                "  PRIMARY KEY (`num`)," +
                "  UNIQUE KEY `index_uid` (`uid`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        try {
            if(true == recreate) {
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建班组管理表
     */
    public static void createUserChart_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.UserChart_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.UserChart_Table + " (" +
                "  `num` int(11) NOT NULL AUTO_INCREMENT," +
                "  `chart_name` varchar(64) NOT NULL DEFAULT '铁塔'," +
                "  `chart_file` varchar(64) NOT NULL DEFAULT 'whyc'," +
                "  `chart_logo` blob," +                                         //首页logo
                "  `chart_normal` blob," +                                         //正常logo
                "  `chart_behind` blob," +                                         //落后logo
                "  `chart_warn` blob," +                                         //告警logo
                "  `chart_timeout` blob," +                                     //延迟logo
                "  `chart_online_charge` blob," +                                 //在线充电
                "  `chart_pre_charge` blob," +                                     //预充电logo
                "  `chart_dev_alarm` blob," +                                     //设备告警
                "  `chart_nuclear_cap` blob," +                                 //核容放电
                "  `Chart_poff` blob," +                                         //停电logo
                "  `Chart_install` blob," +                                     //未安装logo
                "  `Chart_xuhang` blob," +                                         //续航不足logo
                "  PRIMARY KEY (`num`)," +
                "  UNIQUE KEY `unique_index_chart_file` (`chart_file`)" +        //添加唯一索引
                ") ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        ResultSet res = null;
        try {
            if(true == recreate) {
                //sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);
            //添加在线充电列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='chart_online_charge'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `chart_online_charge` blob");
            }
            //添加预充电列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='chart_pre_charge'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `chart_pre_charge` blob");
            }
            //添加设备告警列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='chart_dev_alarm'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `chart_dev_alarm` blob");
            }
            //添加核容放电列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='chart_nuclear_cap'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `chart_nuclear_cap` blob");
            }
            //添加停电列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='Chart_poff'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `Chart_poff` blob");
            }
            //添加未安装列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='Chart_install'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `Chart_install` blob");
            }
            //添加续航不足列
            res = sql.sqlMysqlQuery("SELECT * FROM information_schema.columns"
                    + " WHERE table_schema='web_site'"
                    + " AND table_name='tb_user_chart'"
                    + " AND column_name='Chart_xuhang'");
            if(false == res.next()) {
                sql.sqlMysqlExecute("ALTER TABLE " + Sql_Mysql.UserChart_Table
                                + " ADD COLUMN `Chart_xuhang` blob");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    /**
     * 创建线程监控表
     */
    public static void createProcessSurvey_Table(MysqlConnPool pool, boolean recreate) {
        String sql_str01 = " DROP TABLE IF EXISTS "+Sql_Mysql.ProcessSurvey_Table;
        String sql_str02 = "CREATE TABLE IF NOT EXISTS " + Sql_Mysql.ProcessSurvey_Table + " (" +
                "  `num` int(11) NOT NULL AUTO_INCREMENT," +
                "  `ProcessId` int(12) NOT NULL," +                                             //进程id
                "  `ProcessName` varchar(64) NOT NULL DEFAULT ' '," +                             //进程名称
                "  `ProcessTime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'," +             //进程运行更新时间
                "  `Process_starttime` datetime NOT NULL DEFAULT '1970-01-01 00:00:00'," +         //进程开始启动时间
                "  `ServerName` varchar(64) NOT NULL DEFAULT ' '," +                             //服务名称
                "  `ServerFlag` int(11) NOT NULL DEFAULT '1'," +                                 //服务状态      0:停止     1:正在运行   2禁用
                "  `ProcessVersion` varchar(64) DEFAULT ' '," +                                 //进程版本
                "  `note` varchar(64) NOT NULL DEFAULT ' '," +                                     //备注
                "  `OutTime` int(11) NOT NULL DEFAULT '60'," +                                     //超时时长
                "  PRIMARY KEY (`num`)," +
                "  UNIQUE KEY `ProcessId` (`ProcessId`)" +
                ") ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;";
        Sql_Mysql sql = new Sql_Mysql(pool.getConn());
        ResultSet res = null;
        try {
            if(true == recreate) {
                sql.sqlMysqlExecute(sql_str01);
            }
            sql.sqlMysqlExecute(sql_str02);
            //添加主程序记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11001");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('1', '11001', 'BMS_FBSDEV',                 '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV', '1', 'V1.585', '主程序线程', '300');");
            }
            //添加电池告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11002");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('2', '11002', 'BMS_FBSDEV_ALARM_BATT',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', '电池告警线程', '300');");
            }
            //添加设备告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11003");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('3', '11003', 'BMS_FBSDEV_ALARM_DEV',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_ALARM', '1', 'V1.109', '设备告警线程', '300');");
            }
            //添加落后单体进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11004");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('4', '11004', 'BMS_FBSDEV_BADBATT_MON',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', '落后单体线程', '300');");
            }
            //添加容量告警进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11005");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('5', '11005', 'BMS_FBSDEV_BADBATT_CAP',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_BADBATT', '1', 'v2.303', '容量告警线程', '300');");
            }
            //添加放电计划进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11006");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('6', '11006', 'BMS_FBSDEV_PLAN',             '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_PLAN', '2', ' ', '放电计划线程', '300');");
            }
            //添加机房停电进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11007");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('7', '11007', 'BMS_FBSDEV_POWER_FAIL',     '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_POWER_FAIL', '2', ' ', '机房停电线程', '300');");
            }
            //添加线程监控进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11008");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('8', '11008', 'BMS_FBSDEV_LISTEN',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBSDEV_LISTEN', '1', 'V1.101', '线程监控线程', '300');");
            }
            //添加61850进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11009");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('9', '11009', 'BMS_FBS61850_BATT',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS61850_BATT', '2', 'V1.101', '61850通讯线程', '300');");
            }
            //添加9600进程记录
            res = sql.sqlMysqlQuery("SELECT * FROM "+ Sql_Mysql.ProcessSurvey_Table + " WHERE ProcessId = 11010");
            if(false == res.next()) {
                sql.sqlMysqlExecute("INSERT INTO " + Sql_Mysql.ProcessSurvey_Table + " VALUES ('10', '11010', 'BMS_FBS9600_DISPLAY',         '1970-01-01 00:00:00', '1970-01-01 00:00:00', 'BMS_FBS9600_DISPLAY', '2', 'v1.101', '9600显示模块线程', '300');");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            sql.close_con();
        }
    }
    public static void main(String[] args) {
        MysqlConnPool pool = new MysqlConnPool("123.207.82.239", 3360, 10);
        DB_web_site website = new DB_web_site();
BattMonitor_DB_Builder/src/com/sql/Sql_Mysql.java
@@ -125,7 +125,14 @@
    
    public final static String BTSStationEvent_Table = DB_ALARM + ".`tb_bts_station_event`";                            //机房状态历史表
    
    public final static String ThreadUtil_Table = WEB_Site + ".`tb_thread_util`";
    /**************************** web_site数据库 ***************************************************/
    public final static String ThreadUtil_Table = WEB_Site + ".`tb_thread_util`";                        //线程帮助表
    public final static String PositiomapUsr_Table = WEB_Site + ".`tb_positiomap_usr`";                    //首页地图中心点定位表
    public final static String ChartColor_Table = WEB_Site + ".`tb_chart_color`";                        //用户实时监测页面指定柱状的颜色设置表
    public final static String UserChart_Table = WEB_Site + ".`tb_user_chart`";                            //班组管理表
    public final static String ProcessSurvey_Table = WEB_Site + ".`tb_process_survey`";                        //线程监控表
    //--------------------------------------------------------------------------------------------//
    //--------------------------------------------------------------------------------------------//
    public Connection mysql_con;