Mongo Ruby shards now available

If you have already imported the certificate then you can also use the below code (much simpler version).

import com.mongodb.*;



public class SSLApp1 {


    public static void main(String args[])  throws Exception {



                “C:\\Program Files\\Java\\jre7\\lib\\security\\cacerts”);


        MongoClientOptions o = new MongoClientOptions.Builder()




        MongoClient m = new MongoClient(“<server>:<port>”, o);  


        System.out.println(“Host:” + m.getServerAddressList());


        DB db = m.getDB( “admin” );

        System.out.println(“DB: [” + db + “]”);


        boolean auth = db.authenticate(<user>, <pwd>.toCharArray());

        System.out.println(“auth: [” + auth + “]”);


        com.mongodb.DB db1 = m.getDB(“admin”);

        System.out.println(“Using .command”);

        DBObject cmd1 = new BasicDBObject();


        CommandResult result = db1.command(cmd1);




  • Ask Question