Skip to main content

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&param1=value1&param2=value2
  • Server address format: ip or ip:port. If no port is specified, 27017 is used as the default port. Cluster mode: ip:port;ip:port or ip;ip;ip

Basic Parameters

ParameterDescriptionDefault
usernameDatabase usernameNone
passwordDatabase passwordNone
mechanismAuthentication mechanism, supports PLAIN, SCRAM-SHA-1, SCRAM-SHA-256, GSSAPI, X-509None, auto-negotiated
clientNameClient name, displayed in MongoDB server logsMongo-JDBC-Client

Network & Timeout

ParameterDescriptionDefault
connectTimeoutConnection timeout (milliseconds)Driver default
socketTimeoutSocket read timeout (milliseconds)Driver default
socketSndBufferSocket send buffer size (bytes)Driver default
socketRcvBufferSocket receive buffer size (bytes)Driver default

Read/Write Strategy

ParameterDescriptionDefault
retryWritesWhether to enable retry writestrue
retryReadsWhether to enable retry readstrue

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.

ParameterDescriptionDefault
preReadWhether to enable pre-read. When enabled, query result sets will display all fields in the document.true
preReadThresholdThreshold for swapping pre-read data to disk.5mb
preReadMaxFileSizeMaximum pre-read data file size (MB)20mb
preReadCacheDirPre-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

ParameterDescriptionDefault
timeZoneLocal timezone used by the driver when processing timezone-sensitive data.UTC
customMongoCustom MongoDB client creation. Must implement net.hasor.dbvisitor.adapter.mongo.CustomMongo interface.None