milvus-io / milvus-sdk-java

Java SDK for Milvus.
https://milvus.io
Apache License 2.0
386 stars 156 forks source link

Is there a method to switch to another database after instantiating the client in the Java SDK? #1003

Open alpha2wang opened 2 months ago

alpha2wang commented 2 months ago

Is there a method to switch to another database after instantiating the client in the Java SDK?

yhmo commented 2 months ago

The address of the database is specified when you declaring a MilvusClient, and this address cannot be changed. If you want to connect to another database, declare a new MilvusClient by its address.

xiaofan-luan commented 2 months ago

The address of the database is specified when you declaring a MilvusClient, and this address cannot be changed. If you want to connect to another database, declare a new MilvusClient by its address.

@yhmo @alpha2wang I think we need a "use database xxx"

yhmo commented 2 months ago

If the "database" is db of milvus, MilvusClientV2 has the interface useDatabase(), which can switch to another database. The V1 MilvusClient doesn't have the ability.

But if the "database" is "another milvus instance", then you have to create another MilvusClient to connect.