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
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)
As far as I'm aware, the thin drive will have the same permissions as the user you're connected with will have, therefore, the easiest way to acquire this is by having a user in the database which is read-only. Check the last bit of this link: http://docs.oracle.com/cd/B19306_01/java.102/b14355/apxtips.htm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With