Connection Parameters
Hint
This article is generated by AI translation.
jdbc-mongo supports configuring various parameters in the JDBC URL to control connection behavior, authentication, timeout settings, and more.
JDBC URL Format
jdbc:dbvisitor:mongo://server:port?database=0¶m1=value1¶m2=value2
- Server address format:
iporip:port. If no port is specified,27017is used as the default port. Cluster mode:ip:port;ip:portorip;ip;ip
Basic Parameters
| Parameter | Description | Default |
|---|---|---|
| username | Database username | None |
| password | Database password | None |
| mechanism | Authentication mechanism, supports PLAIN, SCRAM-SHA-1, SCRAM-SHA-256, GSSAPI, X-509 | None, auto-negotiated |
| clientName | Client name, displayed in MongoDB server logs | Mongo-JDBC-Client |
Network & Timeout
| Parameter | Description | Default |
|---|---|---|
| connectTimeout | Connection timeout (milliseconds) | Driver default |
| socketTimeout | Socket read timeout (milliseconds) | Driver default |
| socketSndBuffer | Socket send buffer size (bytes) | Driver default |
| socketRcvBuffer | Socket receive buffer size (bytes) | Driver default |
Read/Write Strategy
| Parameter | Description | Default |
|---|---|---|
| retryWrites | Whether to enable retry writes | true |
| retryReads | Whether to enable retry reads | true |
Pre-Read Configuration
These parameters control pre-read behavior for large files or large volumes of data. When pre-read is enabled, the query result set will display all fields in the document, rather than only the _ID and _JSON fields.
| Parameter | Description | Default |
|---|---|---|
| preRead | Whether to enable pre-read. When enabled, query result sets will display all fields in the document. | true |
| preReadThreshold | Threshold for swapping pre-read data to disk. | 5mb |
| preReadMaxFileSize | Maximum pre-read data file size (MB) | 20mb |
| preReadCacheDir | Pre-read cache directory | (System cache directory) |
- preReadMaxFileSize can be followed by unit suffixes
b,kb,mb,gb, e.g.,10mb. When no unit is specified, MB is used by default.
Other Parameters
| Parameter | Description | Default |
|---|---|---|
| timeZone | Local timezone used by the driver when processing timezone-sensitive data. | UTC |
| customMongo | Custom MongoDB client creation. Must implement net.hasor.dbvisitor.adapter.mongo.CustomMongo interface. | None |