Schema Definitions
To enable consistent support for your Couchbase data, you must configure the connector to use a schema definition from a JSON fileSchemaMapOperation
connection property
For information about how to use the Schema Editor, see the Schema Editor User Guide located in the installation directory of the connector.
- On Windows 7 or earlier, the guide is available from the Simba Couchbase ODBC Driver program group in the Start menu.
- On Windows 8 or later, you can search for the guide on the Start screen.
For information about using connection properties to work with schema definitions, see Working with Schema Definitions Using Connection Properties.
Important:
- Before generating a schema definition, make sure that primary indexes have been created for all of the buckets in your Couchbase database.
- Schema definitions that were created using connector version 1.1.2 or earlier are not supported, and must be recreated using the Schema Editor or the
SchemaMapOperation
connection property.
When the connector connects to a database without a specified schema definition, it automatically generates a temporary schema definition. However, temporary schema definitions do not persist after the connection is closed, and the connector may generate different schema definitions during subsequent connections to the same database due to variances in the data that gets sampled.
Mapping Couchbase Data
Couchbase is able to store data that follows different rules of data typing and structure compared to traditional relational data.
The Simba Couchbase ODBC Driver does the following when generating a schema definition:
- For each document type identified in the database, the connector samples data from multiple documents to detect the structure of the data.
- The connector organizes all the documents into collections based on their type, and saves these collections as part of the schema definition. Using the schema definition, the connector exposes collections as tables in ODBC applications.
- For each array detected in the database, the connector generates a virtual table to expand the data, and saves these virtual tables as part of the schema definition. Using the schema definition, the connector exposes virtual tables as normal tables in ODBC applications.
- The connector defines a Couchbase data type for each column and maps each Couchbase data type to the SQL data type that is best able to represent the greatest number of values.
The tables defined in the schema definition refer to the actual data in the Couchbase database, allowing you to interact with the data through the ODBC layer while leaving the storage of the data in its denormalized form in the database. By querying the tables, you can access the contents of the database. When you write or modify data in a table, the corresponding data in the Couchbase database is updated.
- Base Tables
- Virtual Tables
- Example of Table Creation during Schema Generation
- Features
- Configuring the Connector on page 1