How to access data from Couchbase without connecting the QueryEngine

My client Code :

private static final Logger LOG = LoggerFactory
.getLogger(CouchbaseClusterProvider.class);
private static CouchbaseCluster cluster = null;

/**
 * This method build the Connection object for Couchbase by using Server Name
 *
 * @return cluster
 */

public static CouchbaseCluster getCluster() {
    if (cluster == null) {
        List<String> nodeList = new ArrayList<>();
        String[] addressList = System.getProperty("couchbase.server").split(",");
        for (int i = 0; i < addressList.length; i++) {
            nodeList.add(addressList[i].trim());
        }
        CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
                .queryEnabled(true).build();
        cluster = CouchbaseCluster.create(env, nodeList);
    }
    return cluster;
}

hi @stalin_12,
could you provide a little more details? What are you trying to achieve? What problem/error message do you encounter?
Query engine, also known as N1QL, in its preview version DP4 is activated by the queryEnabled(true) part of your code. It needs a separate server to run along with the couchbase server in order to work for now, so maybe that’s the one part missing (eg. if you get errors about connection to an IP on port 8093)?

Hi Simon,

Thanks a lot for your reply. Actually I was trying to disabueryEnabled(true)le the Query Engine call from my code. The same I achieved by doing queryEnabled(false). By making queryEnabled(false), now my code is not trying to call the separate Query Engine Server. But what I suggest is instead of starting the Query Engine Server separately Couchbase should come up with the in-built support of Query Engine.

Thanks
Stalin

Hi,
Leaving out the queryEnabled(...) altogether will default to false. This configuration parameter is temporary and has been put in place for testing with N1QL DP4, where the engine is separate.

The client will work with Couchbase Server 4.0 (currently not even in dp nor beta), where the engine is built-in and can be present in a subset of the nodes, by discovering automatically if the service is available and on which nodes.