JDBC Driver for Couchbase

Build 26.0.9655

Establishing a Connection

Creating a JDBC Data Source

You can create a JDBC data source to connect from your Java application, based on CData JDBC Driver for Couchbase.

Follow these steps:

  1. Add the driver JAR file to the classpath. The JAR file is located in the installation directory's lib subfolder. Ensure that the .lic file is located in the same folder as the JAR file.
  2. Provide the driver class. For example:
    cdata.jdbc.couchbase.CouchbaseDriver
  3. Provide the JDBC URL. For example:
    jdbc:couchbase:User='myusername';Password='mypassword';Server='http://couchbase40'

    Or, if there is a conflict in your application between drivers using the same URL format, use this form to ensure that you are using the CData driver:

    jdbc:cdata:couchbase:User='myusername';Password='mypassword';Server='http://couchbase40'

    Ensure that the URL starts with either jdbc:couchbase: or jdbc:cdata:couchbase:. The URL can include any of the connection properties in name-value pairs separated with semicolons.

Connecting to Couchbase

To connect to data, set the Server property to the hostname or IP address of the Couchbase server(s) you are authenticating to.

If your Couchbase server is configured to use SSL, you can enable it either by using an https URL for Server (like https://couchbase.server), or by setting the UseSSL property to True.

Couchbase Analytics

By default, the driver connects to the N1QL Query service. In order to connect to the Couchbase Analytics service, you will also need to set the CouchbaseService property to Analytics.

Couchbase Cloud

Set the following to connect to Couchbase Cloud:

  • AuthScheme: Set this to Basic.
  • ConnectionMode: Set this to Cloud.
  • DNSServer: Set this to a DNS server. In most cases, this should be a public DNS service like 1.1.1.1 or 8.8.8.8.
  • SSLServerCert: Set this to the TLS/SSL certificate to be accepted from the server. Any other certificate that is not trusted by the machine is rejected. Alternatively, set "*" to accept all certificates.

Authenticating to Couchbase

The driver supports several forms of authentication. Couchbase Cloud only accepts Standard authentication, while Couchbase Server accepts Standard authentication, client certificates, and credentials files.

Standard Authentication

To authenticate with standard authentication, set the following:

  • AuthScheme: Set this to Basic.
  • User: The user authenticating to Couchbase.
  • Password: The password of the user authenticating to Couchbase.

Client Certificates

The driver supports authenticating with client certificates when SSL is enabled. To use client certificate authentication, set the following properties:

Credentials File

You can also authenticate using using a credentials file containing multiple logins. This is included for legacy use and is not recommended when connecting to a Couchbase Server that supports role-based authentication.

Copyright (c) 2026 CData Software, Inc. - All rights reserved.
Build 26.0.9655