Implement database methods in connection.py