Connect To Your Database

  • how-to
    +
    Use the Connect page to choose how you want to connect to your database.

    This page covers connecting to your database from:

    Prerequisites

    The procedures on this page assume the following:

    • You’ve configured database access by creating a database access credential. You’ll need the username and password for the database credential to connect to the cluster.

    • You’ve added your IP address to the cluster’s list of allowed IPs.

    • You are not connecting from an IPv6-only environment — you need to be able to use the IPv4 records published for Capella clusters.

    Connecting from SDK, CLI, or cbsh

    Follow these steps to connect from either SDK, command line tools, or cbsh:

    • SDK

    • CLI Tools

    • cbsh

    The Connect page in the Capella UI provides the details to connect to the database with an application using an SDK.

    From the Capella UI:

    1. Click on the database that you want to connect to, then click Connect.

    2. From the left navigation pane, select SDK.

    3. If you have not yet entered an allowed IP address, you can add one here.

    4. Choose an existing database user from the drop-down or create a new database access user.

    5. Select the preferred SDK language.

    6. Now install the SDK for the language that you have chosen, following the instructions in the linked SDK docs.

    7. You can either choose a snippet or the full code sample.

      • Selecting Snippet should generate the cluster connection code snippet for the corresponding language chosen, pre-populated with the connection string and user name. Replace <<password>> with the password you specified when you created the database access user.

      • The Full Code Sample should display a full code sample for your chosen language, You can customize the code sample by choosing the bucket, scope, and collection the database user has access to — although some fields will be prepopulated already, such as the connection string and username.

    You can find documentation and troubleshooting reference materials within the SDK Connect UI screen.

    The SDK Compatibility page lists the minimum supported SDK versions. Couchbase recommends using the latest version of your chosen SDK, as it contains bug fixes and feature enhancements.

    Developer Guides show you how to connect an SDK, and create, modify, and query data.

    The Connect page in the Capella UI provides the details to connect to the database with the backup and import and export tools.

    From the Capella UI:

    1. Click on the database that you want to connect to, then click Connect.

    2. From the left navigation pane, select Import & Export Tools.

    3. Download the security certificate, following the instructions on this page.

    4. Download and install the command line tools, following the instructions on the command line tools reference page.

    Basic examples for the tools are given there, along with links to their full reference pages.

    The Connect page in the Capella UI provides the details to connect to the database with cbsh — the Couchbase Shell.

    From the Capella UI:

    1. Click on the database that you want to connect to, then click Connect.

    2. From the left navigation pane, select Couchbase Shell.

    3. If you have not yet entered an allowed IP address, you can add one here.

    4. Choose an existing database user from the drop-down or create a new database access user.

    5. The generated config file should display the pre-populated connection string, username from the database user selected from the dropdown (see sample file, below).

    6. Download and unzip the latest version of Couchbase Shell for your operating system.

    7. Create a hidden folder .cbsh in the same folder where you unzipped the binaries and copy the generated config file in to the hidden .cbsh folder, replacing <<password>> with the password specified for the database user.

    Sample cbsh config file
    version = 1
    [[database]]
    identifier = "capella"
    connstr = "couchbases://<<connection string>>.cloud.couchbase.com"
    user-display-name = ""
    username = "<<username>>"
    password = "<<password>>" # Replace this with password from database access credentials

    You can find some examples, documentation and reference materials within the Connect  Couchbase Shell page.

    Troubleshooting

    Working across networks adds an extra layer of complexity. See the troubleshooting documentation if you have problems making a connection.