Skip to main content

Connect()

This operation establishes the connection between the client and the Milvus server using the given connection parameters.

c++
Status Connect(const ConnectParam& connect_param)

RETURNS:

Status

Returns a Status indicating whether the connection was established successfully.

ERROR HANDLING:

  • std::exception

    Thrown when request construction, transport, or response processing fails. Inspect the exception message or returned Status for failure details.

Example​

Connects to a Milvus server using a URI and token credentials, then checks the returned status.

c++
auto client = milvus::MilvusClientV2::Create();
milvus::ConnectParam connect_param{"YOUR_CLUSTER_ENDPOINT", "YOUR_CLUSTER_TOKEN"};
auto status = client->Connect(connect_param);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}
Minimum SDK versionv3.0.x