| DB2 数据库应用中使用受信任上下文 (1) |
|
| |
|
|
Connection 方法,DB2Connection 类提供了几种版本的 reuseDB2Connection 方法,这些方法使应用服务器可以以新用户的身份重用已有的受信任连接。应用服务器使用该方法将以下项目传递给新用户:
来自初始连接的 cookie。
被重用连接的新的连接属性。
JDBC 驱动程序检查提供的 cookie 是否与底层受信任物理连接相匹配,以确保连接请求是由建立受信任的物理连接的应用服务器发起的。如果 cookie 匹配,则这个新用户可以直接用新的连接属性使用该连接。
例 4. 在 JDBC 应用程序中使用受信任连接
#---------------------------------------------------------------------------
#-- JDBC example
#-- Test a Trusted Context on the connection
#---------------------------------------------------------------------------
/* The first item that was obtained from the previous */
getTrustedPooledConnection
/* Call is a connection object. Cast it to a PooledConnection object. */
javax.sql.PooledConnection pooledCon = (javax.sql.PooledConnection)objects[0];
properties = new java.util.Properties();
// Set new properties for the reused object using
// properties.put("property", "value");
// The second item that was obtained from the previous
getTrustedPooledConnection
/* call is the cookie for the connection. Cast it as a byte array. */
byte[] cookie = ((byte[])(objects[1]);
/* Supply the user ID for the new connection. */
String newuser = "newuser";
// Supply the name of a mapping service that maps a workstation user
// ID to a z/OS RACF ID
String userRegistry = "registry";
/* Do not supply any security token data to be traced. */
byte[] userSecTkn = null;
/* Do not supply a previous user ID. */
String originalUser = null;
// Call getDB2Connection to get the connection object for the new
// user.
java.sql.Connection con = ((com.ibm.db2.jcc.DB2PooledConnection)pooledCon).
getDB2Connection(cookie,newuser,password,userRegistry,userSecTkn,originalUser,properties);
结束语
在电子商务领域,很多应用程序依赖于 Domino 和 WebSphere Application Server 之类的中间件服务器提供的安全性,而受信任上下文是为那些应用程序提供安全环境,同时又不必过多降低性能的理想方法。可以通过调优受信任上下文的安全属性,确保对数据库服务器的无懈可击的访问。而且,由于可以以很少的连接资源切换用户,而不需要身份验证,受信任上下文是商业应用程序的理想选择。(T006)
相关文章:
浅谈db2数据库加密技术: 表数据加密
数据压缩到每一行 省出一半磁盘
上一页 [1] [2]
 |
频道声明:本频道的文章除部分特别声明禁止转载的专稿外,可以自由转载.但请务必注明出出处和原始作者 文章版权归本频道与文章作者所有.对于被频道转载文章的个人和网站,我们表示深深的谢意。
| 原始作者:佚名 |
录入时间:2007-5-23 22:14:19 |
| 信息来源:不详 |
投稿信箱:itqoo@126.com |
|
|
 |
|
|
|
| 教程录入:itqoo 责任编辑:itqoo |
|
上一个教程: DB2 V9.1 复制技术新特性及改进展示 (1)
下一个教程: DB2 XML 全文搜索之为文本搜索做准备 |
| 【字体:小 大】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口】 |