database reconnect after connection loss