<code id="ymukc"><xmp id="ymukc">

Java MongoDAO 初始化

GerD82的頭像 GerD82 -1 2016-04-13 07:34 0


× 1    × 1    × 1   

瀏覽數: 31543

分享時間: 2 年 前



private DB getMongoDB() {
		try {
			if (MONGODB_DB == null) {
				Mongo mgo = new Mongo(ip, port);
				DB db = mgo.getDB(mongodbName);
				char[] pwd = password.toCharArray();
				db.authenticate(user, pwd);

				MongoOptions options = mgo.getMongoOptions();
				options.socketTimeout = 2000;
				options.autoConnectRetry = true;
				options.socketKeepAlive = true;

				MONGODB_DB = db;

				return db;
			} else {
				return MONGODB_DB;
		} catch (Exception e) {
			return null;


  • 273025的頭像 273025 2016-05-16 17:01 代碼數:0


  • 放養筆記的頭像 放養筆記 2016-06-28 18:53 代碼數:0


  • pevahanifo的頭像 pevahanifo 2018-09-22 19:21 代碼數:0

    This is highly information, crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things.

    technology and business news

  • cixexey的頭像 cixexey 2018-08-20 15:30 代碼數:0

    I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have enjoyed reading. Nice blog, I will keep visiting this blog very often.SEO

  • cixexey的頭像 cixexey 2018-08-21 20:04 代碼數:0

    I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article.justcannabis.ca

  • cixexey的頭像 cixexey 2018-08-24 02:06 代碼數:0

    nice bLog! its interesting. thank you for sharing....mobil

  • cixexey的頭像 cixexey 2018-08-24 20:16 代碼數:0

    I wish more authors of this type of content would take the time you did to research and write so well.  I am very impressed with your vision and insight.\

    Michigan Personal Injury Law Firm


<code id="ymukc"><xmp id="ymukc">
<code id="ymukc"><xmp id="ymukc">