MongoDB & Java Connection Error -


i trying run java program java/mongo driver on separate computer 1 running mongod. modified java/mongo tutorial code include ip address.

package mongotest; import com.mongodb.*;  public class main { static dbcursor cur; static dbcollection coll; public static void main(string[] args) {     mongo m;     try{         m = new mongo("192.168.0.102");  // <---- not connect.  time out         db db = m.getdb("playerdb");         coll = db.getcollection("players");          cur = coll.find();         //while (cur.hasnext())          //  coll.remove(cur.next());          coll.ensureindex(new basicdbobject("playerid", 1).append("unique", true));          boolean unique = true;           cur = coll.find();         printresults(cur, "find records");           boolean cancreate;         cancreate = createaccount("josh", "1", cur, coll);         cancreate = createaccount("jason", "1", cur, coll);         cancreate = createaccount("ryan", "1", cur, coll);         cancreate = createaccount("michael", "1", cur, coll);         cancreate = createaccount("john", "1", cur, coll);         cancreate = createaccount("susan", "1", cur, coll);            cur = coll.find();          printresults(cur, "find records after insert");        }//try     catch(exception e){         system.out.println(e);     }//catch } 

(note: time out , quit)

but when run same code on computer running database it's fine.

how can connection between 2 computers on different networks communicate?

first need ensure network route:

can ping computer b computer a?

can telnet mongo port second computer first?

if not, have networking problem not programming one. in case might behoove ask question on serverfault or superuser


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -