运行 此查询需要什么权限?
What privileges are needed to run this query?
我使用 InterSystem 的缓存 JDBC 驱动程序查询 "database dictionary" 以便从 类.
检索源代码
我有这个 SQL 查询:
final String query = "select id, super"
+ " from %Dictionary.ClassDefinition"
+ " where System = '0'"
+ " and name not like '\%%' escape '\'"
+ " and deployed != 2";
现在,执行此查询的用户具有 %All
作为角色,这当然不是什么好事。我尝试将此用户的权限降低到最低限度。
我已连接到命名空间 SAMPLES;我已经创建了一个角色,比如说 FOO
我已经赋予了这些特权:
%Service_SQL
(U);
%DB_SAMPLES
(R);
select
权限 table %Dictionary.ClassDefinition
命名空间 %SYS
.
我试过只给我的用户这个角色;但它在执行时失败(-99 错误翻译:"privilege violation"):
Exception in thread "main" java.sql.SQLException: [SQLCODE: <-99>:<Violación de privilegio >]
[Location: <Prepare>]
[%msg: <User sonar is not privileged for the operation>]
at com.intersys.jdbc.CacheConnection.getServerError(CacheConnection.java:1312)
at com.intersys.jdbc.CacheConnection.processError(CacheConnection.java:1552)
at com.intersys.jdbc.InStream.readHeader(InStream.java:164)
at com.intersys.jdbc.CachePreparedStatement.prepareInternal(CachePreparedStatement.java:633)
at com.intersys.jdbc.CachePreparedStatement.prepare(CachePreparedStatement.java:594)
at com.intersys.jdbc.CachePreparedStatement.<init>(CachePreparedStatement.java:141)
at com.intersys.jdbc.CacheConnection.prepareStatement(CacheConnection.java:1860)
at com.intersys.jdbc.CacheConnection.prepareStatement(CacheConnection.java:484)
at es.litesolutions.cacheqc.dbread.CacheDbReader.listClasses(CacheDbReader.java:47)
at es.litesolutions.cacheqc.dbread.CacheDbReader.main(CacheDbReader.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
我缺少哪些权限才能使用 PreparedStatement
?
(是的,我知道上面的查询没有绑定变量,但其他查询会有绑定变量。)
并且您应该添加对具体 table 的访问。可以在选项卡 SQL table 中为角色或用户执行操作。只需添加 table %Dictiinary.Classdefinition
查找权限设置错误,也可以使用Audit
您应该从命名空间 SAMPLES 添加对 table %Dictionary.ClassDefinition
的访问。选择正确的命名空间很重要,因为您连接到 SAMPLES
。
我使用 InterSystem 的缓存 JDBC 驱动程序查询 "database dictionary" 以便从 类.
检索源代码我有这个 SQL 查询:
final String query = "select id, super"
+ " from %Dictionary.ClassDefinition"
+ " where System = '0'"
+ " and name not like '\%%' escape '\'"
+ " and deployed != 2";
现在,执行此查询的用户具有 %All
作为角色,这当然不是什么好事。我尝试将此用户的权限降低到最低限度。
我已连接到命名空间 SAMPLES;我已经创建了一个角色,比如说 FOO
我已经赋予了这些特权:
%Service_SQL
(U);%DB_SAMPLES
(R);select
权限 table%Dictionary.ClassDefinition
命名空间%SYS
.
我试过只给我的用户这个角色;但它在执行时失败(-99 错误翻译:"privilege violation"):
Exception in thread "main" java.sql.SQLException: [SQLCODE: <-99>:<Violación de privilegio >]
[Location: <Prepare>]
[%msg: <User sonar is not privileged for the operation>]
at com.intersys.jdbc.CacheConnection.getServerError(CacheConnection.java:1312)
at com.intersys.jdbc.CacheConnection.processError(CacheConnection.java:1552)
at com.intersys.jdbc.InStream.readHeader(InStream.java:164)
at com.intersys.jdbc.CachePreparedStatement.prepareInternal(CachePreparedStatement.java:633)
at com.intersys.jdbc.CachePreparedStatement.prepare(CachePreparedStatement.java:594)
at com.intersys.jdbc.CachePreparedStatement.<init>(CachePreparedStatement.java:141)
at com.intersys.jdbc.CacheConnection.prepareStatement(CacheConnection.java:1860)
at com.intersys.jdbc.CacheConnection.prepareStatement(CacheConnection.java:484)
at es.litesolutions.cacheqc.dbread.CacheDbReader.listClasses(CacheDbReader.java:47)
at es.litesolutions.cacheqc.dbread.CacheDbReader.main(CacheDbReader.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
我缺少哪些权限才能使用 PreparedStatement
?
(是的,我知道上面的查询没有绑定变量,但其他查询会有绑定变量。)
并且您应该添加对具体 table 的访问。可以在选项卡 SQL table 中为角色或用户执行操作。只需添加 table %Dictiinary.Classdefinition
查找权限设置错误,也可以使用Audit
您应该从命名空间 SAMPLES 添加对 table %Dictionary.ClassDefinition
的访问。选择正确的命名空间很重要,因为您连接到 SAMPLES
。