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

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()

Check Setting readonly request parameter alternative works.

1 Like

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.