private synchronized void auto_reconnect(){
        System.out.println("Attempting Auto-Reconnect...");
        
        //Clean and desrtoy anything that may be left
        try{mysql_connection.close(); mysql_connection = null;}catch(SQLException e){}
       
        //On a sucesufull connection stop retrying
        boolean connected = false;        
        
        //Attempt to reconnect up to the number of auto_reconnect_retry
        int retries_left = auto_reconnect_retry;
        while(retries_left > 0 && !connected){
            retries_left--;
            System.out.println("Auto-Reconnect Attempt #" + (auto_reconnect_retry - retries_left) + " of " + auto_reconnect_retry);
            try{
                wait(auto_reconnect_time);
                connected = reconnect(hostname_local_cache, username_local_cache, password_local_cache, database_local_cache);                
            }
            catch(InterruptedException i){
                System.err.println("Reconnect Canceled!");
            }      
            catch(SQLTransientConnectionException e){
                System.err.println("AUTO RECONNECT: " + e.getMessage());
            }
            catch(Exception e){
                System.err.println("Unkown faliure: " + e.getLocalizedMessage());
            }
        }
    }