private void MySQL2HTTP() {
        Connection conn = null;
        Statement s = null;
        PreparedStatement ps_select = null, ps_update = null;
        ResultSet rs_select = null;
        int MYSQL_PROXY_PACKETS_ID = 0, SERVER = 0, TARGET_PHP_FILES_RUNS_FUNCTION = 0, TARGET_PHP_FILES_RUNS_FUNCTION_OLD = 0;
        int counter = 1;

        try {
            if ((conn = JavaDBAccess.setConn()) != null) {
                System.out.println("Connected to database " + JavaDBAccess.getDatabaseName());
            } else {
                throw new Exception("Not connected to database " + JavaDBAccess.getDatabaseName());
            }

            conn.setAutoCommit(false);

            s = conn.createStatement();
            //Updates the TARGET_PHP_FILES_RUNS_FUNCTION field of the MYSQL_PROXY_PACKETS table, except for the last TARGET_PHP_FILES_RUNS_FUNCTIONS
//            s.executeUpdate("UPDATE MYSQL_PROXY_PACKETS M SET TARGET_PHP_FILES_RUNS_FUNCTION=(SELECT P.ID FROM TARGET_PHP_FILES_RUNS_FUNCTIONS P WHERE M.PACKET_TIMESTAMP IN ( SELECT PACKET_TIMESTAMP FROM MYSQL_PROXY_PACKETS WHERE PACKET_TIMESTAMP > P.HTTP_REQUEST_TIMESTAMP AND PACKET_TIMESTAMP < ( SELECT MIN(HTTP_REQUEST_TIMESTAMP) FROM TARGET_PHP_FILES_RUNS_FUNCTIONS WHERE HTTP_REQUEST_TIMESTAMP>P.HTTP_REQUEST_TIMESTAMP)))");
            s.executeUpdate("UPDATE MYSQL_PROXY_PACKETS M SET TARGET_PHP_FILES_RUNS_FUNCTION=(SELECT P.ID FROM TARGET_PHP_FILES_RUNS_FUNCTIONS P WHERE M.PACKET_TIMESTAMP > P.HTTP_REQUEST_TIMESTAMP AND M.PACKET_TIMESTAMP < (SELECT MIN(HTTP_REQUEST_TIMESTAMP) FROM TARGET_PHP_FILES_RUNS_FUNCTIONS WHERE HTTP_REQUEST_TIMESTAMP>P.HTTP_REQUEST_TIMESTAMP)) WHERE TARGET_PHP_FILES_RUNS_FUNCTION IS NULL");
            conn.commit();
            //Updates the TARGET_PHP_FILES_RUNS_FUNCTION field of the MYSQL_PROXY_PACKETS table, just for the case of the last TARGET_PHP_FILES_RUNS_FUNCTIONS
            s.executeUpdate("UPDATE MYSQL_PROXY_PACKETS M SET TARGET_PHP_FILES_RUNS_FUNCTION=(SELECT P.ID FROM TARGET_PHP_FILES_RUNS_FUNCTIONS P WHERE M.PACKET_TIMESTAMP IN ( SELECT PACKET_TIMESTAMP FROM MYSQL_PROXY_PACKETS WHERE PACKET_TIMESTAMP > P.HTTP_REQUEST_TIMESTAMP AND P.HTTP_REQUEST_TIMESTAMP = ( SELECT MAX(HTTP_REQUEST_TIMESTAMP) FROM TARGET_PHP_FILES_RUNS_FUNCTIONS))) WHERE TARGET_PHP_FILES_RUNS_FUNCTION IS NULL");
            conn.commit();
            s.close();


            ps_select = conn.prepareStatement("SELECT ID,SERVER,TARGET_PHP_FILES_RUNS_FUNCTION FROM MYSQL_PROXY_PACKETS WHERE CLIENT_SERVER='C' ORDER BY TARGET_PHP_FILES_RUNS_FUNCTION,THIS_THREAD_ID");
            rs_select = ps_select.executeQuery();

            counter = 1;
            while (rs_select.next()) {
                MYSQL_PROXY_PACKETS_ID = rs_select.getInt(1);
                SERVER = rs_select.getInt(2);
                TARGET_PHP_FILES_RUNS_FUNCTION = rs_select.getInt(3);
                if (TARGET_PHP_FILES_RUNS_FUNCTION_OLD != TARGET_PHP_FILES_RUNS_FUNCTION) {
                    counter = 1;
                }
                ps_update = conn.prepareStatement("UPDATE MYSQL_PROXY_PACKETS SET HTTP_PACKET_SEQUENCE=? WHERE ID=?");
                ps_update.setInt(1, counter);
                ps_update.setInt(2, MYSQL_PROXY_PACKETS_ID);
                ps_update.executeUpdate();
                counter++;
                ps_update = conn.prepareStatement("UPDATE MYSQL_PROXY_PACKETS SET HTTP_PACKET_SEQUENCE=? WHERE ID=?");
                ps_update.setInt(1, counter);
                ps_update.setInt(2, SERVER);
                ps_update.executeUpdate();
                counter++;

                TARGET_PHP_FILES_RUNS_FUNCTION_OLD = TARGET_PHP_FILES_RUNS_FUNCTION;
            }
            ps_update.close();
            rs_select.close();
            ps_select.close();
            conn.commit();

            conn.close();

        } catch (Throwable e) {
            System.out.println("exception thrown:");

            if (e instanceof SQLException) {
                JavaDBAccess.printSQLError((SQLException) e);
            } else {
                e.printStackTrace();
            }
        }
    }