简体   繁体   English

Oracle只读JDBC连接

[英]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.

相关问题 是否可以在单个JDBC连接上多路复用多个只读事务 - Is it possible to multiplex multiple read-only transactions on a single JDBC Connection 为什么此连接是只读的? - Why is this connection read-only? 如何将Oracle JBoss数据源定义为只读? - How to define an Oracle JBoss DataSource to be limited to read-only? Oauth2 Spring-boot 只读连接错误 - Oauth2 Spring-boot read-only connection error 从连接池中驱逐到群集中只读节点的连接 - Evicting connections to a read-only node in a cluster from the connection pool 休眠和弹簧,本机选择上的连接是只读错误 - hibernate & spring, Connection is read-only error on native select 如何在Eclipselink上创建只读连接池 - How to create read-only connection pool on Eclipselink 如何在Java中检查休眠会话连接处于只读模式 - how to check hibernate session connection is in read-only mode in Java 我的 spark 代码突然失败,提示“不允许只读用户或只读数据库中的用户在连接上禁用只读模式” - My spark code suddenly failed with "A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection" JDBC oracle 钱包连接 - JDBC oracle wallet connection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM