为 Oracle 数据库创建 JDBC 提供者条目

DatabaseRoute 和 DatabaseRetrieve 节点通过使用存储在 Integration 节点注册表中的连接详细信息构建自己的 JDBC 连接,其中包含标准 DBMS JDBC 提供者设置。

如果您正使用 Oracle 数据库,请使用以下指示信息创建 JDBC 提供者条目。 您可以使用 mqsicreateconfigurableservice 命令(该命令在以下脚本中提供)创建名为 SIMPLERROUTEDB 的新 JDBC 提供者条目。此条目由样本所使用的数据库节点中的“数据源名称”属性字段引用。以下指示信息还可配置具有用户标识和密码的 JDBC 提供者条目以供 Integration 节点在访问数据库时使用。

  1. 为数据库创建 JDBC 提供者条目:

    1. 启动 Integration 节点,并确保已将集成服务器部署到该 Integration 节点。 例如,要启动 Integration 节点,请打开您可以在其中运行 IBM Integration Bus 命令的命令控制台窗口并输入以下命令:
      mqsistart IB9NODE
    2. 在文本编辑器中打开新文档,将以下脚本(该脚本创建 JDBC 提供者条目 SIMPLERROUTEDB 来提供 Simplified Database Routing 样本的 JDBC 数据库访问权)复制并粘贴到文本编辑器中。

      您必须将脚本中的以下占位符替换为适合您的环境的值。

      • <SID> 标识包含此样本使用的表的数据库的 Oracle 系统标识。
      • <JARS URL> 运行 Integration 节点的系统上的本地目录路径,其中有包含类型 4 驱动程序类的 JAR 文件。
        • 在 Windows 上:<ORACLE HOME>\jdbc\lib
        • 在 Linux 上:<ORACLE HOME>/jdbc/lib/
      • <PORT NUMBER> 数据库服务器侦听的端口号。 Oracle 缺省值为 1521
      • <SERVER NAME> 正运行 Oracle 的主机的名称;例如 localhost
      mqsideleteconfigurableservice IB9NODE -c JDBCProviders -o SIMPLERROUTEDB
      mqsicreateconfigurableservice IB9NODE -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" 
      
    3. 保存文件。以下指示信息假设您已调用文件 simplifieddbrouting.bat
    4. 在命令控制台中,浏览至包含 simplifieddbrouting.bat 的文件夹,并输入以下命令以运行脚本:
      simplifieddbrouting.bat

      运行脚本时,它将执行以下任务:

      1. 删除任何名为 SIMPLERROUTEDB 的现有 JDBCProvider 条目
      2. 创建名为 SIMPLERROUTEDB 的新 JDBCProvider 条目以供 Simplified Database Routing 样本使用
    5. 等待脚本完成运行。如果您首次运行该脚本,将显示以下消息:
      BIP8984W: Configurable service object name 'JDBCProviders : SIMPLERROUTEDB' was not found.
      The user has tried to delete or modify a configurable service object name that does not exist.
      Check the names of the existing configurable services using the mqsireportproperties command. 
      Then modify the external resource object name and reissue the command.
      
      BIP2087E: Broker IB9NODE was unable to process the internal configuration message.
      The entire internal configuration message failed to be processed successfully.
      The internal configuration message failed to be processed,
      use the messages following this message to determine the reasons for the failure.
      
      BIP8036E: Negative response received.
      This command sends an internal configuration message to the broker, the response received 
      indicated that the internal configuration message was unsuccessful.
      Check that the WebSphere MQ transport is available. Check the system log for further information.
      
      请忽略此消息。显示此消息是因为脚本尝试先删除名为 SIMPLERROUTEDB 的现有 JDBCProvider 注册表条目,然后再重新创建该条目。如果之前未曾运行此脚本,那么将无法在注册表中找到该条目。
    6. 您可以输入以下命令以检查是否已使用样本 SIMPLERROUTEDB JDBCProvider 条目正确更新了缺省 Integration 节点注册表:
      mqsireportproperties IB9NODE -o SIMPLERROUTEDB -c JDBCProviders -r

      如果已成功更新,那么从该命令报告的属性输出将与以下示例匹配:

      JDBCProviders
        SIMPLERROUTEDB
          connectionUrlFormat='jdbc:oracle:thin:[user]/[password]@[serverName]:[portNumber]:[connectionUrlFormatAttr1]'
          connectionUrlFormatAttr1='orc1'
          connectionUrlFormatAttr2=''
          connectionUrlFormatAttr3=''
          connectionUrlFormatAttr4=''
          connectionUrlFormatAttr5=''
          databaseName='default_Database_Name'
          databaseType='default_Database_Type'
          databaseVersion='default_Database_Version'
          description='Simplified Database Routing Sample Database'
          environmentParms='default_none'
          jarsURL='C:\oracle\oraxx\jdbc\lib'
          portNumber='1521'
          securityIdentity='default_User@default_Server'
          serverName='localhost'
          type4DatasourceClassName='oracle.jdbc.xa.client.OracleXADataSource'
          type4DriverClassName='oracle.jdbc.OracleDriver'
      
      BIP8071I: Successful command completion.
  2. 指定用户标识和密码以与 JDBC 提供者 SIMPLERROUTEDB 相关联:

    使用 mqsisetdbparmsmqsichangeproperties 命令以指定 Integration 节点的用户标识和密码来使用 JDBC 提供者 SIMPLERROUTEDB。此用户标识必须是您创建数据库时所使用的同一用户标识。

    1. 输入以下命令以将用户标识和密码与安全身份相关联:
      mqsisetdbparms IB9NODE -n jdbc::mySecurityIdentity -u <user ID> -p <password>
    2. 输入以下命令以将安全身份(您在上一步中定义的)与 JDBC 提供者 SIMPLERROUTEDB 的 securityIdentity 属性相关联:
      mqsichangeproperties IB9NODE -c JDBCProviders -o SIMPLERROUTEDB -n securityIdentity -v mySecurityIdentity
    3. 您必须停止并重新启动该 Integration 节点以使对 JDBC 提供者所做的更改对已部署的消息流生效。 如果您已部署了该样本,请停止并重新启动该 Integration 节点。

    有关更多信息,请参阅 IBM Integration Bus 文档中的启动到数据库的 JDBC 连接DatabaseRoute 节点的“使 JDBC 提供者服务对 DatabaseRoute 节点可用”部分。

返回“设置 Oracle”

返回到“设置数据库”

返回到样本主页