Created
November 4, 2011 19:00
-
-
Save esedor/1340180 to your computer and use it in GitHub Desktop.
New MongoDB Connection in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.mongodb.*; | |
MongoURI uri = new MongoURI("mongodb://user:pass@localhost:27017/dbname"); | |
DB db = uri.connectDB(); | |
boolean auth = db.authenticate(uri.getUsername(), uri.getPassword()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment