| | |
| | | |
| | | import com.base.Com; |
| | | import com.config.AppConfig; |
| | | import com.config.AppParam; |
| | | import com.sql.MysqlConnPool; |
| | | import com.sql.Sql_Mysql; |
| | | import com.sql.util.Db_Alarm; |
| | | import com.sql.util.Db_Batt; |
| | | import com.sql.util.Db_Dis_Batt; |
| | | import com.sql.util.Db_Param; |
| | | |
| | | public class main_BTS_DB_Builder { |
| | | /**************************************************************************/ |
| | |
| | | public static int MysqlServer_Port = DEF_MysqlServerFBS_Port; |
| | | |
| | | private static AppConfig m_AppConfig; |
| | | private static AppParam m_AppParam; |
| | | |
| | | private static MysqlConnPool GB_MysqlConnPool; |
| | | |
| | |
| | | m_AppConfig = new AppConfig(); |
| | | |
| | | |
| | | System.out.println("正在连接数据库 DBserver IP:" + m_AppConfig.getMysqlServerIp() + ", port: " + MysqlServer_Port); |
| | | System.out.println("正在连接数据库 DBserver IP:" + m_AppConfig.getSqlServerIp() + ", port: " + m_AppConfig.getSqlServerPort()); |
| | | |
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getMysqlServerIp(), MysqlServer_Port, 50); |
| | | GB_MysqlConnPool = new MysqlConnPool(m_AppConfig.getSqlServerIp(), m_AppConfig.getSqlServerPort(), 50); |
| | | |
| | | Sql_Mysql sql_ck = new Sql_Mysql(GB_MysqlConnPool.getConn()); |
| | | if(null != sql_ck.mysql_con) { |
| | | System.out.println("成功连接数据库" |
| | | + " DBserver IP:" + m_AppConfig.getMysqlServerIp() |
| | | + ", port: " + MysqlServer_Port |
| | | + " DBserver IP:" + m_AppConfig.getSqlServerIp() |
| | | + ", port: " + m_AppConfig.getSqlServerPort() |
| | | + " @ " + Com.getDateTimeFormat(new Date(), Com.DTF_YMDhms)); |
| | | }else { |
| | | System.out.println("连接数据库失败"); |
| | | } |
| | | try { |
| | | sql_ck.checkAndCreateDB(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | sql_ck.close_con(); |
| | | } |
| | | |
| | | //初始化电池告警数据库 |
| | | Db_Alarm.init(GB_MysqlConnPool); |
| | | |
| | | //初始化机房配置信息库 |
| | | Db_Batt.init(GB_MysqlConnPool); |
| | | |
| | | //初始化电池组历史数据记录库 |
| | | Db_Dis_Batt.init(GB_MysqlConnPool); |
| | | |
| | | //初始化告警参数库 |
| | | Db_Param.init(GB_MysqlConnPool); |
| | | } |
| | | |
| | | |