[英]grant privileges to Firebird user with jaybird
I did succeed in creating a new user in Firebird through FBUserManager.add(user). 我确实通过FBUserManager.add(user)在Firebird中创建了一个新用户。 I did also succeed to connect with the DB I had already created. 我也确实成功地连接了已经创建的数据库。 What I cannot to how is to run queries, I got the message: 我无法运行查询的消息是:
"org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544352. no permission for read/select access to TABLE " “ org.firebirdsql.jdbc.FBSQLException:GDS异常。335544352。对表的读/选择访问没有权限”
What I understood is that the newly created user has not the correct privileges to run the commands. 我了解的是,新创建的用户没有运行命令的正确权限。 I know how to grant privileges directly in firebird. 我知道如何直接在firebird中授予特权。 But I need to do it from java program using jaybird, is anyone aware on how to do it? 但是我需要使用jaybird从Java程序中执行此操作,有人知道如何执行此操作吗?
There is no API to assign privileges in Jaybird. Jaybird中没有分配权限的API。 You will need to execute a series of GRANT
statements to assign the required rights just like you would directly in Firebird. 您将需要执行一系列GRANT
语句来分配所需的权限,就像直接在Firebird中一样。 Just keep in mind that each GRANT
will need to be executed individually using Statement.execute()
. 请记住,每个GRANT
都需要使用Statement.execute()
单独执行。
Another options is to assign all rights to a role, assign that role to the user and ensure the role is specified (in the connection string or properties) when connecting to the database. 另一个选项是为角色分配所有权限,将该角色分配给用户,并确保在连接到数据库时(在连接字符串或属性中)指定了该角色。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.