MCPcopy Create free account
hub / github.com/MariaDB/server / MongoConnect

Method MongoConnect

storage/connect/Mongo3Interface.java:82–120  ·  view source on GitHub ↗
(String[] parms)

Source from the content-addressed store, hash-verified

80 } // end of GetErrmsg
81
82 public int MongoConnect(String[] parms) {
83 int rc = 0;
84
85 if (DEBUG)
86 System.out.println("Mongo3: URI=" + parms[0] + " DB=" + parms[1]);
87
88 try {
89 MongoClientURI uri = new MongoClientURI(parms[0]);
90
91 client = new MongoClient(uri);
92
93 if (DEBUG)
94 System.out.println("Connection " + client.toString() + " established");
95
96 // Now connect to your databases
97 db = client.getDatabase(parms[1]);
98
99 // if (parms[2] != null && !parms[2].isEmpty()) {
100 // if (DEBUG)
101 // System.out.println("user=" + parms[2] + " pwd=" + parms[3]);
102
103 // @SuppressWarnings("deprecation")
104 // boolean auth = db.authenticate(parms[2], parms[3].toCharArray());
105
106 // if (DEBUG)
107 // System.out.println("Authentication: " + auth);
108
109 // } // endif user
110
111 } catch (MongoException me) {
112 SetErrmsg(me);
113 rc = -1;
114 } catch (Exception e) {
115 SetErrmsg(e);
116 rc = -3;
117 } // end try/catch
118
119 return rc;
120 } // end of MongoConnect
121
122 public int MongoDisconnect() {
123 int rc = 0;

Callers

nothing calls this directly

Calls 1

SetErrmsgMethod · 0.95

Tested by

no test coverage detected