package sqlconnect;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.util.HashMap;

public class Database {
    static HashMap<String, Item> Maps = new HashMap();
    static Connection conn;
    static Statement state;
    public static void init() throws Exception {
        Class.forName(Constant.mysql);
        Readclass.init();
        conn = DriverManager.getConnection(Constant.url,Constant.user,Constant.passwd);
        state = conn.createStatement();
    }
    public static void close() {
        if(state != null) {
            try{
                state.close();
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
        if(conn != null) {
            try{
                conn.close();
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}
