public static Credentials loadCredentials(String aFile) {
        Credentials cre = null;

        try {
            FileInputStream fileIn = new FileInputStream(aFile);
            ObjectInputStream in = new ObjectInputStream(fileIn);

            Object obj = in.readObject();

            if (obj instanceof DBCredentials) {
                cre = (DBCredentials) obj;
            } 

            in.close();
            fileIn.close();

            if (Connector.LOGGER) {
                if (cre instanceof DBCredentials) {
                    System.out.println("DBCredentials loaded succesfully");
                } 
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
            System.err.println("*** Credentials not found ***");
        } catch (IOException e) {
            e.printStackTrace();
            System.err.println("*** Error while loading credentials ***");
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
            System.err.println("*** Credentials' file probably corrupted ***");
        }
        return cre;
    }