在Websphere AppServer 5.1中配置数据源

WebSphere AppServer与DB2安装在同一台服务器上。
配置步骤:
1. 启动WAS。
在Websphere AppServer 5.1中配置数据源
2. 访问http://服务器ip地址:9090/admin。
3. 配置"安全性->JAAS配置->J2C认证数据"。
在Websphere AppServer 5.1中配置数据源
新建一条目,输入DB2数据库的用户名和密码。
在Websphere AppServer 5.1中配置数据源
4. 配置“环境->管理WebSphere变量”配置参数。
在Websphere AppServer 5.1中配置数据源
设置环境变量值,可以只设置“DB2UNIVERSAL_JDBC_DRIVER_PATH”,将其值设为DB2数据库JDBC驱动的所在位置,一般在DB2安装目录下的java文件夹内。
在Websphere AppServer 5.1中配置数据源
在Websphere AppServer 5.1中配置数据源
5. 配置“资源->JDBC提供程序”;
在Websphere AppServer 5.1中配置数据源
在Websphere AppServer 5.1中配置数据源
6. 新建“Provider”,多个数据源可以共用一个JDBC Provider。
要创建的JDBC提供程序类型选择“DB2 Universal JDBC Driver Provider(XA)”。
在Websphere AppServer 5.1中配置数据源
设置JDBC各参数值。
(1)类路径使用环境变量;

在Websphere AppServer 5.1中配置数据源
(2)也可使用直接路径,
在Websphere AppServer 5.1中配置数据源
7. 新建数据源。
在Websphere AppServer 5.1中配置数据源
在Websphere AppServer 5.1中配置数据源
指定数据源名称和JNDI名。
在Websphere AppServer 5.1中配置数据源
认证别名选择刚才配置的DB2用户。
在Websphere AppServer 5.1中配置数据源
8. 配置"定制属性",修改数据库的名称。
在Websphere AppServer 5.1中配置数据源
在Websphere AppServer 5.1中配置数据源
填写要连接的DB2数据库名。
在Websphere AppServer 5.1中配置数据源
9. 测试连接。
在Websphere AppServer 5.1中配置数据源
测试通过,如未通过请检查前面的各步设置是否正确。
在Websphere AppServer 5.1中配置数据源
10. 保存配置更改,配置过程中请随时保存确认修改,保存后所做的各项设置才可生效。
在Websphere AppServer 5.1中配置数据源