Configuring the Data Source Name on Windows
Configure the data source name before you create an ODBC connection to connect to MongoDB. You must configure the MongoDB ODBC driver properties, advanced properties, and schema when you configure a data source name.
Create a data source name in the ODBC datasource administrator to extract data from and load data to a MongoDB database. The data source properties provide information for the MongoDB server and the database. The advanced properties are read and write operations. You can also define a schema after you create a database.
You can find the ODBC datasource administrator in the Control Panel on Windows. Access the 64-bit ODBC datasource administrator in the Secure Agent machine.
MongoDB ODBC Data Source Advanced Properties
When you create a data source name, configure the advanced properties from Advanced Options.
The following table describes the advanced properties in the MongoDB ODBC driver:
Property | Description |
---|
Enable Double-Buffering | Specifies whether the driver retrieves the data using double-buffering or single-buffering. When enabled, the driver uses double-buffering to retrieve the data. When disabled, the driver uses single-buffering to retrieve the data. |
Documents to fetch per block | The maximum number of documents that a query returns at a time. Default is 4096. |
Expose strings as SQL_WVARCHAR | Specifies how the String data type maps to SQL. When enabled, the MongoDB String data type maps to SQL_WVARCHAR. When disabled, the MongoDB String data type maps to SQL_VARCHAR. |
String Column Size | The maximum number of characters that a STRING column can contain. You can specify a maximum value of 2147483647. |
Expose binary as SQL_LONGVARBINARY | Specifies whether the driver returns Binary columns as data of type SQL_LONGVARBINARY or SQL_VARBINARY. When enabled, the driver returns Binary columns as SQL_LONGVARBINARY data. When disabled, the driver returns Binary columns as SQL_VARBINARY data. |
Binary Column Size | The maximum data length for Binary columns. You can specify a maximum value of 2147483647. |
Enable Passdown | Specifies whether the driver optimizes joins between virtual tables, and passes filtering and aggregation optimizations to the MongoDB database for handling. When enabled, the driver optimizes joins between virtual tables, and passes filtering and aggregation optimizations to the MongoDB database for handling. When disabled, the driver does not optimize joins, and does not pass filtering and aggregation optimizations to the MongoDB database. |
Mechanism | Specifies where the driver looks for the schema definition. If you select Database, the driver loads the schema definition from the MongoDB database. If you select Local File, the driver loads the schema definition from the JSON file specified in the Local File field or the LocalMetadataFile key. |
Sampling Method | Specifies how the driver samples data when generating a temporary schema definition. You can choose from the following options: - - Forward: The driver samples data starting from the first record in the database, then samples the next record, and so on.
- - Backwards: The driver samples data starting from the last record in the database, then samples the preceding record, and so on.
|
Sampling Count | The maximum number of records that the driver can sample to generate the schema definition. To sample every record in the database, set this option to 0. |
Sampling Interval | The interval at which the driver samples records when scanning through the database to generate a temporary schema definition. For example, if you set the sampling interval to 2, the driver samples every second record in the database. |
Configuring Logging Options
To help troubleshoot issues, you can enable logging.
Configure the following logging options for the DSN in the ODBC Data Source Administrator:
- Log Level
- Select the following logging levels corresponding to the amount of information that you want to include in log files:
- - OFF. Disables all logging.
- - FATAL. Logs severe error events that lead the driver to abort.
- - ERROR. Logs error events that might allow the driver to continue running.
- - WARNING. Logs events that might result in an error if action is not taken.
- - INFO. Logs general information that describes the progress of the driver.
- - DEBUG. Logs detailed information that is useful for debugging the driver.
- - TRACE. Logs all driver activity.
Note: For Linux, use 0 for OFF; 1 for FATAL; 2 for ERROR; 3 for WARNING; 4 for INFO; 5 for DEBUG; and 6 for TRACE.
- Log Path
- Specify the full path to the folder where you want to save log files. You can type the path into the field, or click Browse and then browse to select the folder.
- Max Number Files
- Specify the maximum number of log files to keep.
Note: After the maximum number of log files is reached, the driver deletes the oldest log file each time when an additional file is created.
- Max File Size
- Specify the maximum size of each log file in megabytes.
Note: After the maximum file size is reached, the driver creates a new file and continues logging.