This class is used to connect to MySQL database,query data and handle errors.