Connection: move get connection by username to shared function