public void createDatabase() {
        try {
            Class.forName("com.mysql.jdbc.Driver");
            //String url = "jdbc:mysql://127.0.0.1/interactive_house?user=root&password=";
            Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/?user=root&password=root");
            ResultSet resultSet = con.getMetaData().getCatalogs();
            Statement st = con.createStatement();
            String query;
            boolean check = false;
            while (resultSet.next()) {
                // Get the database name                
                //databaseName.add(resultSet.getString(1));
                if (resultSet.getString(1).equals("interactive_house")) {
                    System.out.println("Database exists");
                    check = true;
                }

            }
            if (check == false) {
                query = "CREATE DATABASE  IF NOT EXISTS interactive_house";
                st.executeUpdate(query);
                System.out.println("Database Created");
            }
            con = DriverManager.getConnection("jdbc:mysql://127.0.0.1/interactive_house?user=root&password=root");
            st = con.createStatement();
            query = "CREATE TABLE IF NOT EXISTS `devices` (`deviceId` int(20) NOT NULL,`deviceName` varchar(40) NOT NULL,`deviceState` varchar(40) NOT NULL, PRIMARY KEY (`deviceId`))";
            st.executeUpdate(query);
            //System.out.println("Devices Table Created");
            query = "SELECT * FROM devices";
            ResultSet rs = st.executeQuery(query);
            if (!rs.next()) {
                query = "INSERT INTO `devices` VALUES (1,'lightIn','on'),(2,'lightOut','on'),(3,'fan','off'),(4,'heaterRoom','off'),(5,'heaterLoft','off'),(6,'tempRoom','10'),(7,'tempLoft','12'),(8,'door','open'),(9,'stove','off'),(10,'coffee','off'),(11,'bath','on'),(12,'wash','off'),(13,'media','off')";
                st.executeUpdate(query);
                System.out.println("Data Inserted in Device Table");
            }
            query = "CREATE TABLE IF NOT EXISTS `users` (`userid` int(10) NOT NULL AUTO_INCREMENT,`username` varchar(25) DEFAULT NULL,`password` varchar(200) DEFAULT NULL, `access` varchar(25) DEFAULT NULL,PRIMARY KEY (`userid`))";
            st.executeUpdate(query);
            //System.out.println("User Table Created");
            query = "SELECT * FROM users";
            rs = st.executeQuery(query);
            if (!rs.next()) {
                String houseMaster = cryptPassword("HouseMaster");
                String housePerson = cryptPassword("HousePerson");
                String anotherPerson = cryptPassword("AnotherPerson");
                query = "INSERT INTO `userss` (`userid`, `username`, `password`, `access`) VALUES (1, 'HouseMaster','" + houseMaster + "','admin'),(2, 'HousePerson','" + housePerson + "', 'low'), (3, 'AnotherPerson','" + anotherPerson + "', 'high')";
                st.executeUpdate(query);
                System.out.println("Data Inserted in users Table");
            }
            resultSet.close();
            con.close();
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(DatabaseQuery.class.getName()).log(Level.SEVERE, null, ex);
        } catch (SQLException ex) {
            Logger.getLogger(DatabaseQuery.class.getName()).log(Level.SEVERE, null, ex);
        }
    }