Skip to main content

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 via PreparedStatement.
  • Supports multi-command execution with results retrieved through standard JDBC methods.
  • Supports Statement properties: maxRows, fetchSize, timeoutSec.
  • Supports Statement.RETURN_GENERATED_KEYS, automatically returning the generated _id on insert operations.
  • Supports command interceptors for logging, performance monitoring, and similar scenarios.
  • Supports type conversion — for example, when result set returns LONG type, data can be retrieved via ResultSet.getInt or ResultSet.getString.
  • Supports BLOB, CLOB, NCLOB reading.

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.