Introduction
Hint
This article is generated by AI translation.
jdbc-mongo is a MongoDB JDBC driver adapter that allows developers to operate data using standard JDBC interfaces and MongoDB commands. Its purpose is to enable developers to seamlessly use MongoDB through the familiar JDBC programming model.
Core Features
- JDBC compatible — implements standard JDBC interfaces for seamless integration with any JDBC-compatible framework.
- Rich command set — supports commonly used MongoDB commands, including collection, database management, index management, user management, and more.
- Supports command parameter placeholder
?, with parameters set viaPreparedStatement. - Supports multi-command execution with results retrieved through standard JDBC methods.
- Supports
Statementproperties:maxRows,fetchSize,timeoutSec. - Supports
Statement.RETURN_GENERATED_KEYS, automatically returning the generated_idon insert operations. - Supports command interceptors for logging, performance monitoring, and similar scenarios.
- Supports type conversion — for example, when result set returns
LONGtype, data can be retrieved viaResultSet.getIntorResultSet.getString. - Supports
BLOB,CLOB,NCLOBreading.
Architecture Design
jdbc-mongo internally uses the official MongoDB driver for communication, parses commands via ANTLR4, and converts them to MongoDB BSON operations.
Use Cases
- Accessing MongoDB in a unified way (JDBC) within Java projects.
- Operating MongoDB using native command syntax.
- Integrating MongoDB into existing JDBC-based data processing pipelines.