[#941860] Merge methods for connecting with database - refactoring