IBM WebSphere MQ的oracle的jdbc
一、IBM WebSphere MQ7.0的jdbc支持数据库有:
- DB2
- Informix
- Informix_With_Date_Format
- Microsoft_SQL_Server
- Oracle
- Sybase_JConnect6_05
本文以oracle的jdbc为例,以两种方法建jdbc,详情如下:
二、命令建jdbc
1、打开MB命令控制台(可参考http://www.cnblogs.com/hhl-kf/archive/2012/09/25/2694052.html)
2、创建配置服务(Oracle JDBC)
mqsicreateconfigurableservice MB7BROKER -c JDBCProviders -o SIMPLERROUTEDB
-n connectionUrlFormat,connectionUrlFormatAttr1,description,jarsURL,portNumber,
serverName,type4DatasourceClassName,type4DriverClassName
-v "jdbc:oracle:thin:[user]/[password]@[serverName]:[portNumber]:[connectionUrlFormatAttr1],
<SID>,Simplified Database Routing Sample Database,<JARS URL>,<PORT NUMBER>,
<SERVER NAME>,oracle.jdbc.xa.client.OracleXADataSource,oracle.jdbc.OracleDriver"
其中:
-c JDBCProviders :配置服务类型为jdbc;-o SIMPLERROUTEDB :jdbc名称为SIMPLERROUTEDB;
-n 为参数名称,多个参数间用","分隔,-v 为参数对应的值,多个值间为","分隔;
<JARS URL> oracle的jdbc驱动全路径
<PORT NUMBER> oracle端口,默认为1521
<SID> oracle实例名,没有偿试过集群时,服务名和sid不一致时,写服务名是否正确
<SERVER NAME> oracle所在服务器ip地址
示例如下,建oracle的jdbc名为CQMSTCDB:
(1)mqsicreateconfigurableservice MB7BROKER -c JDBCProviders -o CQMSTCDB -n connectionUrlFormat,connectionUrlFormatAttr1,description,jarsURL,portNumber,serverName,type4DatasourceClassName,type4DriverClassName -v "jdbc:oracle:thin:cqmstcmstc@192.168.4.248:1521:cqmstc,cqmstc,Simplified Database Routing Sample Database,D:\oracle\product\10.2.0\db_1\jdbc\lib,1521,192.168.4.248,oracle.jdbc.xa.client.OracleXADataSource,oracle.jdbc.OracleDriver"
(2)mqsicreateconfigurableservice MB7BROKER -c JDBCProviders -o CQMSTCDB -n connectionUrlFormat,connectionUrlFormatAttr1,description,jarsURL,portNumber,serverName,type4DatasourceClassName,type4DriverClassName -v "jdbc:oracle:thin:[user]/[password]@[serverName]:[portNumber]:[connectionUrlFormatAttr1],cqmstc,Simplified Database Routing Sample Database,D:\oracle\product\10.2.0\db_1\jdbc\lib,1521,192.168.4.248,oracle.jdbc.xa.client.OracleXADataSource,oracle.jdbc.OracleDriver"
注意上面(1),(2)中,-v "jdbc:oracle:thin:[user]/[password]@[serverName]:[portNumber]:[connectionUrlFormatAttr1]" 可以明确值,也可以不明确值。
3、设置安全标识:mySecurityIdentity,并绑定用户名密码 -u cqmstc -p cqmstc
mqsisetdbparms MB7BROKER -n jdbc::mySecurityIdentity -u cqmstc -p cqmstc
4、将安全标识挂接到配置服务
mqsichangeproperties MB7BROKER -c JDBCProviders -o CQMSTCDB -n securityIdentity -v mySecurityIdentity
5、重启代理,执行组:mqsireload MB7BROKER -e default
6、删除配置服务
mqsideleteconfigurableservice MB7BROKER -c JDBCProviders -o CQMSTCDB
7、命令查看配置服务(Oracle JDBC)
mqsireportproperties MB7BROKER -o CQMSTCDB -c JDBCProviders -r
8、界面查看配置服务,可选中配置服务,右键选择【属性】进行编辑修改
三、图形化界面创建jdbc
1、打开MQ资源管理器,WebSphere MQ Explorer
2、右键点击【可配置服务】,选择【新建】-【可配置服务】
3、输入jdbc名称,CQMSTCDB,选择类型为:JDBCProviders,选择模板为:oracle
4、修改参数对应的值,如下所示:
5、单击【完成】,保存成功,查看也上面一致;
6、绑定用户名密码并重启,使密码生效:
mqsisetdbparms MB7BROKER -n jdbc::mySecurityIdentity -u cqmstc -p cqmstc
mqsireload MB7BROKER -e default
参考:WebSphere MQ Explorer 教程