Answer the question
In order to leave comments, you need to log in
How to connect in Java to CouchDB?
Hello.
Recently I decided to try the CouchDB DBMS.
Initially, the installation was on localhost:5984/_utils.
Then I changed its port to 2006, created a couchdb DB for tests, and came up with a name and password.
Now there was a desire to write a client in Java
Connected libraries
couchbase-core-io-1.4.0.jar
couchbase-java-client-2.4.0.jar
rxjava-1.2.3.jar
tried to connect like this
String Name = "dbcouch";
String Password = "password";
String BucketName="couchdb";
DefaultCouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder().build();
CouchbaseCluster cluster = CouchbaseCluster.create(env, "192.168.10.12:2006");
ClusterManager clusterManager = cluster.clusterManager(Name, Password);
if (clusterManager.hasBucket(BucketName)) {
BucketSettings bucketSettings = clusterManager.getBucket(BucketName);
Bucket bucket = cluster.openBucket(BucketName, "");
bucket.close();
}
cluster.disconnect();
exception: java.lang.RuntimeException: com.couchbase.client.deps.io.netty.channel.ConnectTimeoutException: connection timed out: DESKTOP-PC/192.168.56.1:8091
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question