Revert "cleaned database connect"

This reverts commit e55ea8e74bf2d77ba7388f640670316d55726e16.
Revert "Revert "cleaned database connect""

This reverts commit a5ba47724c3066756ccc09e1f35e571d43974c26.