Able to connect the database after checking

Need further testing for the checking algorithm