🚀 Try Zilliz Cloud, the fully managed Milvus, for free—experience 10x faster performance! Try Now>>

Milvus
Zilliz
< Docs
  • Java

useDatabase()

This operation changes the database in use.

public void useDatabase(String dbName)

Request Syntax

useDatabase(String dbName)

PARAMETERS

  • dbName (String) -

    The name of the target database.

RETURNS

void

EXCEPTIONS

  • InterruptedException

    This exception will be raised when any error occurs during disconnection from Milvus.

Example

import io.milvus.v2.client.ConnectConfig;
import io.milvus.v2.client.MilvusClientV2;

// 1. Set up a client
ConnectConfig connectConfig = ConnectConfig.builder()
        .uri("http://localhost:19530")
        .token("root:Milvus")
        .build();
        
MilvusClientV2 client = new MilvusClientV2(connectConfig);

// 2. Switch the client to another database
client.useDatabase("my_database")

Try Managed Milvus for Free

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

Get Started
Feedback

Was this page helpful?