The MongoDb JDBC Driver

  1. What are JDBC Drivers
  2. What is the JDBC URL
  3. Download the MongoDb JDBC Driver
  4. How to Connect using the DbSchema MongoDb Client

What are JDBC Drivers?

JDBC drivers are Java library files with the extension '.jar', used by Java applications to connect to the database. Usually they are provided by the same company which developed the database software. DbSchema is an MongoDb Client which already includes the MongoDb JDBC driver. DbSchema can configure the MongoDb JDBC URL and test the connectivity.

What is the JDBC URL?

The URL is a string (text) with a specific format containing information about the host where the database is running, the port, username, database name, etc. The URL format is specific to each driver. Any wrong character in the URL may make the database connectivity fail. Therefore we recommend installing DbSchema and try to get connected, and you will find the JDBC URL in the connection dialog.

Open-Source MongoDb JDBC Driver

We open source our JDBC driver for MongoDb. DbSchema features for MongoDb are described here. The driver source code is accessible on GitHub.

The driver binaries can be downloaded as zip file, which you should uncompress.

Download JDBC Driver

Download the zip, unpack and include the jar files in your classpath. The driver is compatible with Java 11. for any issues with the driver, you can write to us.

For accessing the driver source code please visit the GitHub repository:

Driver Source Code

The driver is written on top of the native MongoDb Java driver.

The driver URL is the same as in the MongoDb documentation.
Example :

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

The URL allows connecting to multiple databases. In DbSchema you can set this by choosing 'Custom URL' in the connection editor and entering the URL as string. For URL details check the MongoDb documentation.

MongoDb Atlas

Create an account by MongoDb Atlas and login. There you have an option to connect which will provide the URI. In the DbSchema Connection Dialog use manual URL configuration. On the same connection page you have also a link to change a user password in the database.

Mongo-Atlas

Connect to MongoDb using DbSchema Client

DbSchema is using JDBC Drivers to connect to the database. Installing the application you can easy set up a connection. DbSchema will build the JDBC URL for you.
  1. 1 Download DbSchema. DbSchema has a free community edition. No email or registration is required.
  2. 2 Choose to connect to the database, and choose MongoDb. Connect to database
  3. 3 Connection-dialog

    At this point, DbSchema already downloads the JDBC driver into this folders:

    • C:\Users\YourUser\.DbSchema\drivers\MongoDb (Windows) or
    • /Users/YourUser/.DbSchema/drivers/MongoDb (Linux and MacOS).

    In the Connection Dialog, select the driver and the JDBC URL template. For databases using multiple possibilities to connect, may exists multiple templates. Choose if the database is running on the current machine or a different port. If is running on a different machine (remote), you need to find the host name. Hover the Host info label using the mouse to get instructions.

  4. 4 Press the Ping button to test the connectivity.
  5. 5 Edit JDBC URL In the URL combo there is an option to 'Manually Edit the URL'. Select this option to see the generated JDBC URL.
  6. 6 DbSchema Layouts After connecting, DbSchema will create the first diagrams (layouts). Double-click any table header or column to edit.
  7. 7 SQL Editor Activate the SQL Editor from the menu to edit and execute queries. For a detailed list of features, please read the DbSchema Quick Tour.