Oracle read-only JDBC connection

database, java, jdbc, oracle

Solution

As suggested in comments. Best is to grant the read only permissions to user accessing the database.

There is an alternative which is not suggested.

You can set the readOnly parameter in the Connection class using connection.setReadOnly.

Refer API docs for more details.

http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#setReadOnly(boolean)

Problem

Is there a way to acquire read-only JDBC connection from an oracle database. Typically I am looking for a jdbc url parameter that will enable this, something like: ``` jdbc:oracle:thin:@hostname:1521:sid?readonly=true ``` I am using the thin driver

Original source