public final class SQLPermission extends BasicPermission
SecurityManager将在运行启用了SecurityManager的应用程序的代码时检查的SecurityManager ,调用DriverManager.deregisterDriver方法, DriverManager.setLogWriter方法, DriverManager.setLogStream (弃用)方法, SyncFactory.setJNDIContext方法, SyncFactory.setLogger方法, Connection.setNetworktimeout方法或Connection.abort方法。
如果没有SQLPermission对象,这些方法会抛出一个java.lang.SecurityException作为运行时异常。
一个SQLPermission对象包含一个名称(也称为“目标名称”),但没有动作列表; 有一个命名的权限或没有。 目标名称是权限的名称(见下文)。 命名约定遵循层次化属性命名约定。 另外,星号可能会出现在名称的末尾,遵循“。”或本身表示通配符匹配。 例如: loadLibrary.*和*表示通配符匹配,而*loadLibrary和a*b不。
下表列出了所有可能的SQLPermission目标名称。 该表给出了许可允许的描述以及授权许可的风险的讨论。
Connection method abort Permits an application to terminate a physical connection to a database. setSyncFactory Allows the invocation of the SyncFactory methods setJNDIContext and setLogger Permits an application to specify the JNDI context from which the SyncProvider implementations can be retrieved from and the logging object to be used by the SyncProvider implementation. setNetworkTimeout Allows the invocation of the Connection method setNetworkTimeout Permits an application to specify the maximum period a Connection or objects created from the Connection will wait for the database to reply to any one request. deregisterDriver Allows the invocation of the DriverManager method deregisterDriver Permits an application to remove a JDBC driver from the list of registered Drivers and release its resources.
BasicPermission , Permission , Permissions , PermissionCollection , SecurityManager , Serialized Form
| Constructor and Description |
|---|
SQLPermission(String name)
用指定的名称创建一个新的
SQLPermission对象。
|
SQLPermission(String name, String actions)
创建一个具有指定名称的新的
SQLPermission对象。
|
equals, getActions, hashCode, implies, newPermissionCollectioncheckGuard, getName, toStringpublic SQLPermission(String name)
SQLPermission对象。
该名称是SQLPermission的符号名称。
name -此的名称
SQLPermission对象,它必须是
setLog ,
callAbort ,
setSyncFactory ,
deregisterDriver ,或
setNetworkTimeout
NullPointerException - 如果
name是
null 。
IllegalArgumentException - 如果
name为空。
public SQLPermission(String name, String actions)
SQLPermission对象。
名称是SQLPermission的象征名称;
行动String目前未使用,应为null 。
name -此的名称
SQLPermission对象,它必须是
setLog ,
callAbort ,
setSyncFactory ,
deregisterDriver ,或
setNetworkTimeout
actions - 应为
null
NullPointerException - 如果
name是
null 。
IllegalArgumentException - 如果
name为空。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.