public final class SQLPermission extends BasicPermission
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
目标名称。该表给出了权限允许的描述和授予代码权限的风险的讨论。
Permission Target Name | What the Permission Allows | Risks of Allowing this Permission |
---|---|---|
setLog | Setting of the logging stream | This is a dangerous permission to grant. The contents of the log may contain usernames and passwords, SQL statements, and SQL data. |
callAbort | Allows the invocation of the 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, newPermissionCollection
checkGuard, getName, toString
public SQLPermission(String name)
SQLPermission
对象。这个名字的
SQLPermission
符号名称。
name
-这
SQLPermission
对象的名称,它必须是
setLog
,
callAbort
,
setSyncFactory
,
deregisterDriver
,或
setNetworkTimeout
null
name
NullPointerException
。
IllegalArgumentException
-如果
name
是空的。
public SQLPermission(String name, String actions)
SQLPermission
对象。这个名字的
SQLPermission
符号名称;行动
String
目前未使用的,应
null
。
name
-这
SQLPermission
对象的名称,它必须是
setLog
,
callAbort
,
setSyncFactory
,
deregisterDriver
,或
setNetworkTimeout
actions
应该
null
null
name
NullPointerException
。
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.