Skip to main content

Introduction

Hint

This article is generated by AI translation.

jdbc-mongo is a MongoDB JDBC adapter that lets developers operate MongoDB via standard JDBC interfaces and MongoDB commands. The goal is to let you use MongoDB seamlessly with the familiar JDBC programming model.

Core Features

  • JDBC compatible: implements standard JDBC interfaces and integrates with any JDBC-capable framework.
  • Rich command set: supports common MongoDB commands including Collections, Database, Index, and User.
  • Supports command placeholders ? with PreparedStatement for bind arguments.
  • Supports multiple commands executed together and retrieving multiple results via standard JDBC methods.
  • Supports Statement properties: maxRows, fetchSize, timeoutSec.
  • Supports Statement.RETURN_GENERATED_KEYS, automatically returning the generated _id on insert.
  • Supports interceptors for logging, performance monitoring, etc.
  • Supports type conversion; e.g., a LONG result can be read via ResultSet.getInt or getString.
  • Supports BLOB, CLOB, NCLOB reads.

Architecture

Internally uses the official MongoDB driver for communication, ANTLR4 to parse commands, and converts them to MongoDB BSON operations.

Use Cases

  • Need unified (JDBC) access to MongoDB in Java projects.
  • Prefer to use the original command syntax for MongoDB.
  • Need to integrate MongoDB into existing JDBC-based data processing flows.