I am new to MongoDB. How to list all databases of mongodb through Simba JDBC driver. have tried alot but I am only able to get the name of database through which I have build the connection URL. Even, I am not sure that, is this possible or not to get the list of all databases?
I have tried this way: Class.forName("com.simba.mongodb.jdbc4.Driver");
Connection conn = DriverManager
.getConnection("jdbc:mongodb://admin:admin@localhost:27017/admin);
//In the getConnection parameters, last admin is the name of database.
DatabaseMetaData dbmd = conn.getMetaData();
ResultSet ctlgs = dbmd.getCatalogs();
while (ctlgs.next()){
System.out.println("ctlgs="+ctlgs.getString(1));
}
But, it only gives the connected database name. Appreciate help.