[英]Oracle read-only JDBC connection
Is there a way to acquire read-only JDBC connection from an oracle database. 有没有办法从oracle数据库获取只读JDBC连接。 Typically I am looking for a jdbc url parameter that will enable this, something like:
通常我正在寻找一个jdbc url参数来启用它,例如:
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. 您可以使用connection.setReadOnly在Connection类中设置readOnly参数。
Refer API docs for more details. 有关详细信息,请参阅API文档。
http://docs.oracle.com/javase/6/docs/api/java/sql/Connection.html#setReadOnly(boolean) 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
检查此链接的最后一位: http : //docs.oracle.com/cd/B19306_01/java.102/b14355/apxtips.htm
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.