[英]how to check if user has write access to a database in java
I want to check if the user has write access permission to given database and server name using java. 我想检查用户是否具有使用java对给定数据库和服务器名称的写访问权限。
I am using Sybase database 我正在使用Sybase数据库
for example 例如
server :ABC_server 服务器:ABC_server
db: xx_db 分贝:xx_db
I want to check basically the user is in "read-write" group. 我想基本上检查用户是否在“读写”组中。 if he is in that group, he will definitely have access to read and write permissions.
如果他属于该组,则他绝对有权访问读写权限。
Generally speaking database permissions can begin from database/schema level permissions to specific table and column level select/insert/update permissions. 一般来说,数据库权限可以从数据库/架构级别的权限到特定的表和列级别的选择/插入/更新权限开始。 Different databases have different levels.
不同的数据库具有不同的级别。 If you want to know whether a user has permission at any level you can do one of these:
如果您想知道用户是否具有任何级别的权限,可以执行以下任一操作:
Typically system table access is limited to admin users only. 通常,系统表访问仅限于管理员用户。 Therefore No. 1 is not an option.
因此1号不是一个选择。 Then you will be left with only No. 2. Try the operation on the database and table of your interest.
然后,您将只剩下2号。尝试对您感兴趣的数据库和表进行操作。 If the operation fails you know the user has no permission.
如果操作失败,您将知道用户没有权限。 If the operation succeeds you may have to roll back the changes done if the operation was insert/update.
如果操作成功,则如果操作是插入/更新,则可能必须回滚所做的更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.