private void dbCheck(String dir){   //checks to see if the db has been created
   File isdb = new File(dir +"\\myDB"); 
   if (isdb.exists()){
       
       if (DBRead.DBIntegrityCheck(countries)){
           JOptionPane.showMessageDialog(null,"The Database appears to be damaged, please wait create a new one.",
        "Warning",JOptionPane.WARNING_MESSAGE);
           DBRead.DBDelete(countries);
           new Thread(new XmlParser(countries, false, appP)).start();
       }
       else if  (!DBRead.DBIntegrityCheck(countries)){  
       // if db files exists check for the date tables were loaded.
       // if less then 24 hours old prompt to load again
      
       Boolean refresh = dbDateCheck();
       int c=0;
        if (!refresh){
       c = JOptionPane.showConfirmDialog(null, "The currecncy information is less than 24 hours old.\n"
                   + "Do you want to update anyway?", "Question", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
       // if user selects yes, update the tables
       if (c==0){
           new Thread(new XmlParser(countries, false, appP)).start();
       }
       }
       // if dates are older than 24 hours, update tables
       else if (refresh){     
       new Thread(new XmlParser(countries, false, appP)).start();
       }
   }
   }
   
   
   else{// if it does not exist run the DB create class to create DB
      // show message box informing that a db does not exist
     JOptionPane.showMessageDialog(null,"A Database does not exist, please wait for the database to be created",
        "Warning",JOptionPane.WARNING_MESSAGE);
       new DBCreate(countries, dir, appP);
   }
}