mongo-java-driver最新jar.zip

时间:2023-04-02 07:33:28
【文件属性】:

文件名称:mongo-java-driver最新jar.zip

文件大小:10.53MB

文件格式:ZIP

更新时间:2023-04-02 07:33:28

数据库驱动

mongo-java-driver3.0以上jar压缩包大全 try { //1.连接池相关选项配置 MongoClientOptions options=MongoClientOptions.builder() .connectionsPerHost(poolSize) .minConnectionsPerHost(minpoolsize) .maxConnectionIdleTime(maxidletimems) .threadsAllowedToBlockForConnectionMultiplier(blockSize) .maxWaitTime(maxWaitTime) .socketTimeout(socketTimeout) .connectTimeout(connectTimeout) .build(); //2.鉴权配置 MongoCredential credential = MongoCredential.createScramSha1Credential(uname, "admin", pwd.toCharArray()); List credentials = new ArrayList(); credentials.add(credential); //3.mongodb服务器相关配置 List addresses=new ArrayList(); addresses.add(new ServerAddress(host, port)); //4.创建客户实例,获取数据库存储对象。 MongoClient mongoClient = new MongoClient(addresses,credentials, options); morphia.mapPackage("com.lolaage");// 告诉morphia到哪个包下面去找实体类 logger.warn("获取数据库连接对象>>>>>>>>>>>>>>>>>"); ds = morphia.createDatastore(mongoClient, databaseName);// 构建Datastore对象,其中`databaseName`是数据库名称 ds.ensureIndexes();//确保索引生效 //} catch (UnknownHostException e) { // logger.error(e.getMessage()); }


【文件预览】:
mongojar
----mongo-java-driver-3.4.2-sources.jar(1.1MB)
----mongo-java-driver-3.4.2-javadoc.jar(2.82MB)
----mongo-java-driver-3.11.2.jar(2.2MB)
----mongo-java-driver-3.8.1.jar(1.94MB)
----mongo-java-driver-3.5.0.jar(1.73MB)
----mongo-java-driver-3.4.2.jar(1.6MB)

网友评论