Creating a Schema Definition Using Connection Properties
If you are working with a Couchbase database that does not already have a valid schema definition, it is recommended that you create one to enable consistent support for your data.
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.
You can set the connection properties described below in a connection stringodbc.ini
file). Settings in the connection string take precedence over
settings in the DSN
To create a schema definition using connection properties:
- Set your connection properties as follows:
- Set the
SchemaMapOperation
property to1
. - Set the
LocalSchemaFile
property to the full path and name of a JSON file for storing the schema definition locally. If you specify a file that does not already exist, the connector creates it when generating the schema definition. - Set the
SampleSize
property to the number of documents that you want the connector to sample to detect the structure of the data. - Set the
TypeNameList
property to a comma-separated list of the attributes that the buckets use to specify document types. Each list item must be a bucket name surrounded by back quotes (`
), a colon (:
), and an attribute name surrounded by back quotes (`
). For more information and an example of how to set this property, see TypeNameList. - Connect to the database.
Important:
When you generate the schema definition, it overwrites any existing content in the JSON file.
When you connect to the database using the settings described above, the connector samples the data, generates a schema definition, and then stores it in the specified JSON file.
You can now use this schema definition for your connection by loading it directly from the JSON file, or import the schema definition into the database so that it can be used by all users. For more information, see Specifying a Schema Definition Using Connection Properties or Importing a Schema Definition Using Connection Properties.
- Working with Schema Definitions Using Connection Properties
- Schema Definitions
- Creating a Data Source Name
- Configuring a DSN-less Connection
- Using a Connection String
- Driver Configuration Options on page 1