use exception to handle database error for MySQL test