Bug fix: Database connection should be initialized everytime a query is performed

When a dataset is deleted, it's needed to remove all the users that have adquired this dataset. To do so, a connection to the database is required. However, this connection was not initialized in this operation so in some cases (when the database connection hadn't been initialized in another operation) the user got an error.