Q: Java: Simple If Statement not executing Alright, so this has been pissing me off for hours .I do not understand why isn't this if statement not executing. Here's my complete code. There are 2 classes, 'Client' is the main class and the other is the connector class.
package com.app.client;

import java.net.ServerSocket;
import java.sql.SQLException;

public class Client{

    private int IntervalForDatabase=60000;
    private int IntervalForIPCheck=180000;
    private boolean AppRunning=true;
    public boolean ConnectionSuccess=false;
    private Connector ConnectionTools = new Connector();

    public static void main(String args[]){
        Thread thread = new Thread(new Runnable(){
            public void run(){
                Client client = new Client();
            }
        });
        thread.start();
    }

    Client(){
        /* Check For Current Instance Of Program */
        try{
            ServerSocket ApplicationSocket = new ServerSocket(6251);
        }catch(Exception e){
            System.exit(0);
        }

         Thread Network = new Thread(new Runnable(){
            public void run(){
                while(!ConnectionSuccess){
                    try{
                        ConnectionTools.ConnectToDatabaseServer();
                        ConnectionSuccess=true;
                        System.out.println("bein a bit");
                    }catch(Exception e){

                    }
                }
            }
        });
        Network.start();

        Thread LiveConnectionCheck = new Thread(new Runnable(){
            public void run(){
                while(AppRunning){
                    if(ConnectionSuccess){
                     /* THIS IF STATEMENT IS NOT EXECUTING */
                        try {
                            System.out.println("tester");
                            Thread.sleep(IntervalForIPCheck);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
            }           
        });

        LiveConnectionCheck.start();
    }
}

The connector class:
package com.app.client;

import java.net.Socket;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Connector {
    public boolean DatabaseConnection=false;
    Socket ClientSocket;
    private String DatabaseHost="localhost";
    private String DatabaseUsername="root";
    private String DatabasePassword = "";
    private String DatabaseName = "spyware";
    private String TableName="activespywares";
    public String CurrentServerIP = "";
    private Connection MYSQLConnection = null;
    public ResultSet result;

    public void ConnectToDatabaseServer(){
        try{
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            MYSQLConnection = DriverManager.getConnection("jdbc:mysql://"+DatabaseHost+"/"+DatabaseName,DatabaseUsername,DatabasePassword);
            DatabaseConnection=true;            
            System.out.println("connected");
        }catch(Exception e){
            System.out.println(e);
            DatabaseConnection=false;
            return;
        }
    }

    public String ObtainServerIP() throws SQLException{
        String text = "";           
        try{
            System.out.println("we've made it till here");
            PreparedStatement state = MYSQLConnection.prepareStatement("SELECT * FROM `activespywares`");
            result = state.executeQuery();
            System.out.println("we've made it till here");
            if(result.next()){
                result.next();
                text = result.getString("InternetProtocol");
            }
            return text;
        }catch(Exception e){
            System.out.println(e);
            text=e+"";
        }
        return text;
    }
}

I've checked everything. I don't know what is the problem over here. The if statement is in the 'Client' Class. The connector class is just so you know that it's isn't causing problems.

A: Make connectionSuccess either volatile or change to an AtomicBoolean (and mark as final). The problem is that you are setting the variable in one Thread but reading it from another. 

A:         if(result.next()){
            result.next();

Make no sense. You are throwing the first result away when you call result.next() twice here.

A: For your exceptions, I would recommend the usage of 
 e.printStackTace()

in the case of something breaking your program.
Now if you execute
    //...your code
    if(result.next()){
        result.next();
    //...your code

It throws away your first result and presents you with your second result. I would recommend that you use
    //...your code
    while(result.next()){

    //...your code

to scroll through your records as you please
