I am confused in using couchbase java sdk when I want to use it to execute some N1QLs
For example, there are 2 buckets, BucketA and BucketB.
I want to query the data in BucketA first, so I open the BucketA to query.
But it also works if I want to query the data in BucketB later when I open the BucketA to query.
Should I close the BucketA and then open BucketB to query?
What are the differences in using the same bucket to query and using the different bucket to query another bucket?
CouchbaseService cs = CouchbaseService.getInstance(IP);
Bucket bucket_a = cs.OpenBucket("BucketA");
String query1 ="SELECT * FROM BucketA WHERE name = 'jack'";
String query2 ="SELECT * FROM BucketB WHERE name = 'jack'";
List<String> qResult=cs.N1qlQuery(query1, bucket_a);
for (String result : qResult)
System.out.println(result);
//Should I close the BucketA and then open BucketB to query?
qResult=cs.N1qlQuery(query2, bucket_a);
for (String result : qResult)
System.out.println(result);