Java SDK / N1QL: Prevent update / write queries from being executed with bucket.query() (like JDBC executeQuery vs. executeUpdate)

java
n1ql

#1

With bucket.query(String n1ql) it is possible to execute SELECT, UPDATE and also DELETE queries.

In Java JDBC drivers you have two separate methods:

Are the plans to do this separation too?

We would welcome that, as it makes it easier to prevent mistakes. Currently we do all kinds of checks to make sure only SELECT statements make it into bucket.query()


#2

Check Setting readonly request parameter alternative works.

https://developer.couchbase.com/documentation/server/current/n1ql/n1ql-rest-api/index.html


#3

Just for others: The readonly flag seems to be in the 2.5.x Java SDK. In 2.4.5 it was probably not exposed yet.