Use getConnectionRef() in ExternalStoreDB to avoid connection leaks