简体   繁体   English

使用jaybird向Firebird用户授予特权

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

相关问题 如何向当前用户授予特权 - How to grant privileges to current user Derby GRANT语句用于为特定用户提供特权 - Derby GRANT statement using for give privileges to a specific user Jaybird(Firebird JDBC)ResultSet FetchSize —分页持久查询 - Jaybird (Firebird JDBC) ResultSet FetchSize — Pagination long lasting queries 如何使用Firebird的jaybird JDBC驱动程序将绑定值设置为NULL? - How to set bind values to NULL with Firebird's jaybird JDBC driver? 使用@(at)符号的Firebird SQL查询 - 如何在JDBC(Jaybird)中运行查询? - Firebird SQL Query with @ (at) sign - How to run the query in JDBC (Jaybird)? 使用Jaybird连接到位于本地网络中计算机上的Firebird数据库 - Using Jaybird to connect to a Firebird database located in a computer in a local network 无法加载Firebird客户端库:使用Jaybird嵌入数据库 - Failed to load Firebird client library: Embedded database with Jaybird 向所有用户授予mysql特权? - Grant privileges to all users mysql? Java JDBC类型转换(Firebird / Jaybird):在使用getter或updater ResultSet方法之前检查值/类型兼容性吗? - Java JDBC type conversion (Firebird / Jaybird): check value/type compatibility before using getter or updater ResultSet method? 如何将 DB2 中的数据库权限授予其他域用户 - How to grant database privileges in DB2 to other Domain users
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM