Mongodb Java Driver Source Download

For information on next generation MongoDB drivers. Java: Releases: Source: API: JIRA. ← MongoDB Ecosystem Documentation Contents C# and.NET MongoDB Driver. A simple Java + MongoDB hello world example. Get Mongo Java Driver. Download mongo-java driver from github. Love Java and open source stuff.

Active3 years, 9 months ago

I'm really new in Java and also MongoDB world. I would like to use MongoDB and Java. I have downloaded MongoDB driver for java. It is a jar file, my question is how can I use this Jar file. I've used this command but I got an error:

and the error:

no main manifest attribute, in mongo-java-driver-2.9.3-javadoc.jar

could you please help me to solve the problem?

TangoStarTangoStar
1912 gold badges6 silver badges20 bronze badges

3 Answers

First, that is not the correct jar. The jar you are referencing above contains the javadocs.

The driver jar is: mongo-java-driver-2.9.3.jar.

Secondly, you need to add the jar to your project's classpath in order to use it. These are not executable jars. Take a look at the getting started docs here:

There is no 'installing' the driver. You just add it as a dependency in your project and you use it in your code. You do have to install the database itself. The installation packages for the database are available here: http://www.mongodb.org/downloads

gregwhitakergregwhitaker
11k6 gold badges60 silver badges68 bronze badges

Some jar files include an entry point and thus can be run by themselves, using a command like the one you tried.

Download

Other jar files do not include an entry point; they are just libraries to be used by other Java classes. The MongoDB Java driver is like this. It's not designed to be used by itself.

If you are new to Java, you should probably spend some time learning Java before trying to use the Mongo Java driver. You might try http://docs.oracle.com/javase/tutorial/. You should probably at least get though the 'Language Basics' section before trying to use MongoDB with Java.

If you want to use MongoDB by itself, you can use it with the Mongo shell.

John FeibuschJohn Feibusch

This is how to use the 3.x monogo java driver. download the bson, monogodb driver core and mongodb driver.

Mongodb Java Driver Source Download

add these jar files to CLASSPATH.

Or

Hafiz Shehbaz AliHafiz Shehbaz Ali

Not the answer you're looking for? Browse other questions tagged javamongodbjarmongodb-java or ask your own question.

About JDBC Drivers

JDBC drivers are Java library files with the extension .jar used by all Java applications to connect to the database. Usually they are provided by the same company which implemented the Mongodb software. DbSchema installation kit already include an Mongodb driver.

Each JDBC driver is using a specific URL. The URL is a string passed to the driver, formatted in a way which is decided by the team who bild the driver, and which usually includes information about the database host, port and database name.

Open-Source MongoDb JDBC Driver

Details about DbSchema query language for MongoDb and features can be read here. The driver is written on top of the standard 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.

Alternative to installing DbSchema you may download the Mongodb driver using this link. The driver files are compressed in a zip file. The driver source code is open source, posted on BitBucket.

Please write us for any question or issue with the driver.

MongoDb Atlas

Create an account by MongoDb Atlas and login. There you have an option to connect which will provide the URI. Use this in DbSchema Advanced tab. On the same connection page you have also a link to change a user password in the database.


Download Mongodb JDBC Driver

Free download and install DbSchema to get the JDBC driver and test connectivity to Mongodb.

  1. Download and install DbSchema.
  2. Start DbSchema and choose 'Reverse engineer the schema from database'. This will pop-up the database connection dialog.
  3. Try to connect to the database.
  4. The JDBC driver can be found in the home directory '.DbSchema/drivers' or in the DbSchema installation 'drivers' folder.
  5. The connection URI can be found in the connection dialog 'Advanced' tab.

Connect to Mongodb from DbSchema

Start DbSchema, choose 'Connect to database' and in the connection dialog choose 'Mongodb' from the database combo. There you can upload the JDBC driver. For a limited list of databases the drivers are already included.

Next step is to fill in the connection dialog the database host, port, username and password.

Java Mongodb Api

  • The host is the name or the IP address of the machine where the database is running. If the database is running on the same machine as DbSchema, this will be localhost.
  • The port is a number, a kind of 'door' where the database listen for requests. This has a default value which DbSchema will set for you. If the database administrator choose a different port, you may have to enter the correct value
  • Database username is the user to login into the database. DbSchema may enter by default the most user for each database. If this is not correct, check the database documentation for this. Usually during Mongodb installation you are informed about the username.
  • Database password for the database user, is set inside the database.
DbSchema will replace this values in the JDBC URL string, will send this to server and try to connect.

Connectivity Troubleshooting

Mongo Db Java Driver Download

If you get problems connecting to database, please remember :
  • Enable Remote connections as they not always enabled by default. This may require configuration changes.
  • Make sure the host is reachable. From the connection dialog you can ping the database host ensure the configured port is reachable.
  • Windows Firewall may block the communication. You may need to reconfigure or disable it.
  • Check the driver version is compatible with the database software. It may be that DbSchema provided JDBC driver is not the latest version. Please inform us in this case.

Mongodb Java Driver Jar

Learn more about how to connect to database from the DbSchema help.