milvus-logo
LFAI
< Docs
  • Java

createDatabase()

This operation creates a database with a name.

public void createDatabase(CreateDatabaseReq request)

Request Syntax

createDatabase(CreateDatabaseReq.builder()
    .databaseName(String databaseName)
    .properties(Map<String, String> properties)
    .build()
)

BUILDER METHODS:

  • databaseName(String databaseName)

    The name of the database to create.

  • properties(Map<String, String> properties)

The properties of the database, such as replica number, resource groups.

RETURNS:

void

EXCEPTIONS:

  • MilvusClientExceptions

    This exception will be raised when any error occurs during this operation.

Example

Map<String, String> properties = new HashMap<>();
properties.put(Constant.DATABASE_REPLICA_NUMBER, "2");
CreateDatabaseReq createDatabaseReq = CreateDatabaseReq.builder()
        .databaseName(databaseName)
        .properties(properties)
        .build();
client.createDatabase(createDatabaseReq);

Try Managed Milvus for Free

Zilliz Cloud is hassle-free, powered by Milvus and 10x faster.

Get Started
Feedback

Was this page helpful?