correction sql bugs & gestion  connections