1

I'm working with GridDB CE in a Java application and trying to programmatically delete a database. However, I'm encountering that error.

145045 JC_DATABASE_NOT_EMPTY ERROR Checking of client request failed. Number of DB containers may not be zero. Delete all containers in the DB targeted for deletion.

I want to delete an entire database (or simulate that by removing all its data). For example, before running an integration test or during cleanup, I want to ensure the DB is clean.

import com.toshiba.mwcloud.gs.*;
public class GridDBCleanup {
 public static void main(String[] args) throws Exception {
 Properties props = new Properties();
 props.setProperty("notificationAddress", "239.0.0.1");
 props.setProperty("notificationPort", "31999");
 props.setProperty("clusterName", "myCluster");
 props.setProperty("user", "admin");
 props.setProperty("password", "admin");
 GridStore store = GridStoreFactory.getInstance().getGridStore(props);
 // Attempt to drop database (simulated cleanup)
 store.dropDatabase("testDB"); // This line throws the error
 }
}

I've Tried Ensured that testDB exists and is accessible.

Verified that containers are still present using getContainerNames.

Tried iterating and deleting containers manually before calling dropDatabase, but I want to know if there's a better/more idiomatic way to clean a DB.

What is the correct approach to fully delete a database or simulate that in GridDB?

Do I have to delete all containers manually before using dropDatabase()?

Is there a built-in way to list and delete all containers programmatically?

Any help or a working snippet would be appreciated!

Luuk
9365 silver badges13 bronze badges
asked Jun 8 at 9:06
0

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.