Initialize database connection on Lost connection problem

Hello,
On a lost connection error, is there a way to restart a database connection
whitout restarting my program ?

Thanks for answers...