Register function, connect the DB