JDBC Driver for Couchbase

Build 24.0.9060

Data Model

Overview

Depending upon the connection settings being used, the driver can present several different mappings between Couchbase entities and relational tables and views. For more details on each of these capabilities, refer to the NoSQL portion of this documentation.

  • When connecting to the N1QL query service, the driver models Couchbase buckets as relational tables. In addition, if TypeDetectionScheme is set to DocType or Infer, the driver will present different document flavors in each bucket as their own tables.
  • When connecting to the Analytics service, the driver models Couchbase datasets as relational views.
  • When connecting with either service, the driver can expose arrays of data as child tables or views.

Please see the Automatic Schema Discovery section for more details on how flavor and child tables are exposed. In addition, the NewChildJoinsMode connection property is recommended for workflows that make heavy use of child tables. The documentation for that connection property details the improvements it makes to the driver data model.

Dataverses, Scopes and Collections

Couchbase has different ways of grouping buckets and datasets depending on the CouchbaseService and version of Couchbase you are connecting to:

  • Couchbase organizes Analytics datsets into groups called dataverses. By default the driver exposes datasets from all dataverses using compound names like Default.users as described in DataverseSeparator. It is important to remember that these compound names must be quoted when used in queries, for example SELECT * FROM [Default.users]
  • You may also set the Dataverse property to limit the the driver to exposing a single dataverse. This disables compound names so view names will not include the dataset.
  • When connecting to Couchbase 7 and above, the driver will use the scope, collection and bucket/dataset name to build table and view names. For example, a table with a name like crm.accounts.customers exposes the customers collection under the accounts scope of the crm bucket. These must be quoted the same as other compound names when used in queries, for example SELECT * FROM [crm.accounts.customers]

Live Metadata

All of the schemas provided by the driver are dynamically retrieved from Couchbase, so any changes in the buckets or fields within Couchbase will be reflected in the driver the next time you connect. You may also issue a reset query to refresh schemas without having to close the connection:

RESET SCHEMA CACHE

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 24.0.9060