I am trying to connect to Couchbase through JDBC, but it is behaving arbitrarily as it gives a timeout exception many times. I also tried to increase the time out, but it still errors out. The following is the code used to connect to Couchbase:
public static CouchbaseCluster connectToDB(String URL, String userid, String password) throws BusinessException
{
CouchbaseEnvironment env = null;
CouchbaseCluster cluster = null;
try
{
env = DefaultCouchbaseEnvironment.builder().connectTimeout(10000).queryEnabled(true).build();
cluster = CouchbaseCluster.fromConnectionString(env, URL);
} catch (Exception e) {
LOGGER.error(e.getMessage());
}
return cluster;
}
Also, we are using Jars :couchbase-core-io-1.2.7.jar and couchbase-java-client-2.2.6 and the couchbase version we are trying to connect to is Couchbase version 4.5.1-2841 Enterprise Edition
I also tried to increase the timeout using .connectTimeout(1000000), but the issue still persists.