We discussed the various APIs provided by the Couchbase SDK for connecting to the Couchbase server and performing operations on it. Let's now try to focus on the APIs specific to Java. We are going to explain Java SDK 2.1.3. If you are a seasoned software developer, you might have some ideas about what are required to perform operations on the database system. We need to know the hostname or the IP address of the servers that run the Couchbase database. Of course, you need the database name, which is the bucket in the Couchbase system, to connect to it before performing any operations:
Cluster cluster = CouchbaseCluster.create(); Bucket defaultBucket = cluster.openBucket();
The preceding statements create a Cluster object using a CouchbaseCluster
factory class, which will be used to connect to the bucket. If you didn't specify any parameters to the create()
method, then it will connect to the localhost; that is, Couchbase should be running on the server in which the...