-2

Cloudant Client library available in Java that will store one document at a time,

CloudantClient client = ClientBuilder.account("accounbt")
                    .username("username").password("password")
                    .disableSSLAuthentication().build();*/

            Database db = client.database("databaseName", true);

            db.save(jsonObject);

Is there any way to save bulk document in cloudant?

Vimal Dhaduk
  • 994
  • 2
  • 18
  • 43

1 Answers1

1

Here is the code that can enable to upload bulk upload,

CloudantClient client = ClientBuilder.account("accounbt")
                        .username("username").password("password")
                        .disableSSLAuthentication().build();*/

Database db = client.database("databaseName", true);

List<JSONObject> arrayJson = new ArrayList<String>();
arrayJson.add(new JSONObject("{data:hello}"));
arrayJson.add(new JSONObject("{data:hello1}"));
arrayJson.add(new JSONObject("{data:hello2}"));
db.bulk(arrayJson);
Vimal Dhaduk
  • 994
  • 2
  • 18
  • 43
  • 1
    You should **not** turn off SSL Authentication for connections to Cloudant, you are opening yourself up to security problems. – rhyshort Dec 01 '16 at 13:44
  • why is it causing any issue? – Vimal Dhaduk Dec 01 '16 at 17:49
  • Disabling SSL Authentication means that host name verification and certificate chain validation is **not** performed. Meaning someone could potentially pretend to be cloudant take your credentials and access your private data. – rhyshort Dec 02 '16 at 07:43