milvus-logo
LFAI
< Docs
  • Java
    • v1

dropDatabase()

The MilvusClient interface. This method drops a database. Note that this method drops all data in the database.

R<RpcStatus> dropDatabase(DropDatabaseParam requestParam);

DropDatabaseParam

Use the DropDatabaseParam.Builder to construct a DropDatabaseParam object.

import io.milvus.param.collection.DropDatabaseParam;
DropDatabaseParam.Builder builder = DropDatabaseParam.newBuilder()

Methods of DropDatabaseParam.Builder:

Method

Description

Parameters

withDatabaseName(String databaseName)

Sets the databaseName name. Database name cannot be empty or null.

databaseName: The database name

build()

Construct a CreateDatabaseParam object.

N/A

The DropDatabaseParam.Builder.build() can throw the following exceptions:

  • ParamException: error if the parameter is invalid.

Returns

This method catches all the exceptions and returns an R<RpcStatus> object.

  • If the API fails on the server side, it returns the error code and message from the server.

  • If the API fails by RPC exception, it returns R.Status.Unknown and the error message of the exception.

  • If the API succeeds, it returns R.Status.Success.

Example

import io.milvus.param.collection.DropDatabaseParam;

DropDatabaseParam param = DropDatabaseParam.newBuilder()
        .withDatabaseName("mydb")
        .build();
R<RpcStatus> response = client.dropDatabase(param)
if (response.getStatus() != R.Status.Success.getCode()) {
    System.out.println(response.getMessage());
}
Feedback

Was this page helpful?