Manage Database Connections

This topic describes how to connect to and disconnect from a Zilliz Cloud database.

Prerequisites

  • A Zilliz Cloud account with an active project and an available database within it.
  • User access to the project and database.
  • Your IP address added in the IP Whitelist.
  • PyMilvus or Java SDK installed on your device.

Check the database endpoint

From your Zilliz Cloud homepage, go to your database page via Projects > Your Project > Your Database. You will see a Quick connect card right under the Overview tab.

Copy the endpoint information or use View guide to copy a provided set of code that can be integrated directly into your Python or Java scripts.

Connect to a database

Now that you have the endpoint, connect to your database with the following commands and parameters.

# Run `python3` in your terminal to operate in the Python interactive mode.
from pymilvus import connections
connections.connect(
  alias="default", 
  uri='endpoint', 
  port='19530',
  secure=True,
  user='user',
  password='password'
)
final MilvusServiceClient milvusClient = new MilvusServiceClient(
  ConnectParam.newBuilder()
    .withHost("endpoint")
    .withPort(19530)
    .withSecure(true)
    .withAuthorization("user","password")
    .build()
);
Parameter Description
alias Alias of the connection.
uri Endpoint of your database. Copy the endpoint as is to avoid connection issues. You must use https:// to connect over TLS.
port Port of your database endpoint.
secure Boolean value to control the secure mode. It must be set as True.
user Username of the user to log in the database. Note that this is not your Zilliz Cloud account but a database user that you set up in the Database User page.
password Password of the user to log in the database.
Parameter Description
Host Endpoint of the Zilliz Cloud database.
Port Port of the Zilliz Cloud database.
Secure Boolean value to control the secure mode. It must be set as true.
Authorization Username and password of the user to log in the database. Note that this is not your Zilliz Cloud account but a database user that you set up in the Database User page.

Disconnect from a Zilliz Cloud database

Disconnect from a Zilliz Cloud database.

connections.disconnect("default")
milvusClient.close()
Parameter Description
alias Alias of the Zilliz Cloud database to disconnect from.

Troubleshooting

Q: Why can’t I connect to the database after the database is created?

A: You can identify the problem by following these steps:

  1. Check if the database status is AVAILABLE. You cannot connect to the database if the database is initializing, deleted, or when its IP whitelist is being updated.
  2. Check if the IP address of your connection is included in the IP white list.
  3. Test the connectivity of the port by running telnet in01-<xxx>.<region>.vectordb.zillizcloud.com 19530.

See Troubleshooting guide for detailed instruction. If the issue remains unsolved after all above steps are tried, please contact our support team at cloud-support@zilliz.com.