SAP PI PO JDBC接口培训视频

SAP PI PO JDBC接口培训视频

XML Document Format for the Message Protocol XML SQL Format

SAP PI PO JDBC接口培训视频

 You can modify one or more database tables by means of a message. Depending on the content of the message, you can either insert (INSERT), update (UPDATE), or delete (DELETE) the data. Results from queries (SELECT) can also be included in the response in XML format for synchronous messages. The XML document must have the following schema in this case:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <StatementName1>
    <dbTableName action=”UPDATE” | “UPDATE_INSERT”>
      <table>
        realDbTableName
      </table>
      <access>
        <col1>val1</col1>
        <col2>val2new</col2>
      </access>
      <key1>
        <col2>val2old</col2>
        <col4>val4</col4>
      </key1>
      <key2>
        <col2>val2old2</col2>
      </key2>
    </dbTableName>
  </StatementName1>
  <StatementName2>
    <dbTableName action=”INSERT”>
      <table>
        realDbTableName
      </table>
      <access>
        <col1>val1</col1>
        <col2>val2</col2>
      </access>
      <access>
        <col1>val11</col1>
      </access>
    </dbTableName>
  </StatementName2>
  <StatementName3>
    <dbTableName action=”DELETE”>
      <key1>
        <col2>val2old</col2>
        <col4>val4</col4>
      </key1>
      <key2>
        <col2>val2old2</col2>
      </key2>
    </dbTableName>
  </StatementName3>
  <StatementName4>
    <dbTableName action=”SELECT”>
      <table>
        realDbTableName
      </table>
      <access>
        <col1/>
        <col2/>
        <col3/>
      </access>
      <key1>
        <col2>val2old</col2>
        <col4>val4</col4>
      </key1>
      <key2>
        <col2>val2old2</col2>
      </key2>
    </dbTableName>
  </StatementName4>
  <StatementName5>
    <storedProcedureName action=” EXECUTE”>
      <table>
        realStoredProcedureeName
      </table>
      <param1 [isInput=”true”] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
  </StatementName5>
  <StatementName6>
    <anyName action=” SQL_QUERY” | “SQL_DML”>
      <access>SQL-String with optional placeholder(s)</access>
      <key>
        <placeholder1>value1</placeholder1>
        <placeholder2>
        value2
        <placeholder2>
      </key>
    </anyName >
  </StatementName6>
</root>

Comments

The document contains a tag with the arbitrary name<root>. Within this tag there are one or more statement elements that also have arbitrary names. Each of these statements contains the description of a database action. With the exception of the execute description for a stored procedure (shown in the example under the element<StatementName5>), all statements have the same structure:

The name of the element beneath the statement element specifies the name of the database table and contains the attributeactionwith the valueINSERTUPDATEUPDATE_INSERTDELETE, orSELECT. If you use the optional<table>element, the value specified is used as a database table name. This enables you, for example, to define table names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder. If specified,<table>must be the first element in the block within<dbTableName>

Within this element there is (except for in theDELETEaction) an element with the nameaccessand one or more elements with arbitrary names. In the above example, these elements are calledkeyN. Theaccesselement contains the table columns which are to be accessed. It must be specified as the first element. Thekeyelements describe a condition for access. If no such elements are specified, access proceeds without any conditions. In the case ofUPDATEandDELETE, this can lead to the entire table being updated or deleted respectively.

If you want to ensure this does not happen, select Key Tags Mandatory in the adapter configuration.

The response documents described below can only be evaluated by the Integration Server/PCK if the call is synchronous because the content of the response document is not accessible if the call is asynchronous. The response is put in a separate element< StatementName_response>for each statement element.

action= UPDATE

Statements with this action cause existing table values to be updated. Therefore, the statement corresponds to an SQL UPDATE statement.

The<access>block contains the new column values and a<key>element contains the columns whose values must be identical with the specified value to get the new column values. The name of the<key>element is arbitrary. Column values within a<key>element are combined with a logical AND; different<key>elements are combined with a logical OR.

A statement with the actionUPDATEmust have exactly one<access>element. The number of<key>elements with arbitrary names is not restricted.

The corresponding SQL statement forStatementName1in the example above is as follows:

UPDATE dbTableName SET col1=’val1’, col2=’val2new’ WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))

As in the other examples, the column typeStringis used for all columns. The character“may be missing in other column types.

The response document contains the following element as well as the number of updated table lines, including 0.

<update_count>count</update_count>

If there is no<key>element, or if there is a<key>element but it is empty, then no condition is specified and the entire table is to be updated. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.

action= INSERT

Statements with this action cause table values to be inserted. Therefore, the statement corresponds to an SQL INSERT statement.

The<access>block contains the new column values.

A statement with the actionINSERTmust have at least one<access>element. It cannot have a<key>element.

The corresponding SQL statement forStatementName2in the example above is as follows:

INSERT INTO dbTableName (col1, col2) VALUES(‘val1’, ‘val2’)

INSERT INTO dbTableName (col1) VALUES(‘val11’)

The response document contains the following element as well as the number of inserted table lines, including 0.

<insert_count>count</insert_count>

action= UPDATE_INSERT

The statement has the same format as for theUPDATEaction. Initially, the same action is executed as forUPDATE. If no update to the database table can be made for this action (the condition does not apply to any table entry), values of the table described in the <access> element are inserted in accordance with the description of the actionINSERT<key>elements are ignored in this case.

The response document has the following format; one of the two values is always 0 because either anUPDATEor anINSERTaction is always executed:

<update_count>count</update_count>

<insert_count>count</insert_count>

action= DELETE

Statements with this action cause existing table values to be deleted. One or more<key>elements formulate the condition for which table values are deleted. The names of<key>elements are arbitrary. Column values within a<key>element are combined with a logical AND; different<key>elements are combined with a logical OR.

The corresponding SQL statement forStatementName3in the example above is as follows:

DELETE FROM dbTableName WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))

The response document contains the following element:

<delete_count>count</delete_count>

If there is no<key>element, or if there is a<key>element but it is empty, then no condition is specified and the entire table is to be deleted. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.

action= SELECT

Statements with this action cause existing table values to be selected. Therefore, the statement corresponds to an SQL SELECT statement.

The<access>block contains the column names to be selected, a<key>element contains the columns whose values must be identical with the specified value to get the new column values. The name of the<key>element is arbitrary. Column values within a<key>element are combined with a logical AND; different<key>elements are combined with a logical OR.

A statement with the actionSELECTmust have exactly one<access>element. The number of<key>elements with arbitrary names is not restricted.

The corresponding SQL statement forStatementName4in the example above is as follows:

SELECT col1,col2,col3 FROM dbTableName WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))

If there is no<key>element, or if there is a<key>element but it is empty, then no condition is specified and the entire table is to be selected. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.

The response document contains the result of the action in XML format as follows:

<row>

<column1>value11</column1>

<column2>value12</column2>

</row>

<row>

<column1>valueN1</column1>

<column2>valueN2</column2>

</row>

action= EXECUTE

Statements with this action result in a stored procedure being executed. The name of the element is interpreted as the name of the stored procedure in the database. If you use the optional <table> element, the value specified here is used as the stored procedure name. This enables you, for example, to define stored procedure names containing non-XML-compatible characters or characters that prevent them from being used in interface definitions in the Integration Builder/PCK. If specified, <table> must be the first element in the block within <dbTableName>.

The elements within the stored procedure are interpreted as parameters. They can optionally have the attribute isInput=“1“ (input parameter) or isOutput=“1“ (output parameter) or both (INOUT parameter). If both attributes are missing, the element is interpreted as an input parameter. The parameter names must be identical to those of the stored procedure definition.

The attributetype=<SQL-Datatype>, which describes the valid SQL data type, is mandatory for all parameter types (IN, OUT, INOUT).

The following SQL data types are supported:

INTEGER, BIT, TINYINT, SMALLINT, BIGINT, FLOAT,REAL, DOUBLE, NUMERIC, DECIMAL,CHAR, VARCHAR, STRING, LONGVARCHAR, DATE, TIME, TIMESTAMP, BINARY, VARBINARY, LONGVARBINARY, BLOB (input and output),CLOB (input and output), CURSOR (output; only in conjunction with the Oracle JDBC driver)

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 6
    评论
SAP PI/PO(Process Integration/Process Orchestration)是一种集成平台,用于连接不同系统之间的数据交换和流程集成。JDBC(Java Database Connectivity)是一种用于连接和操作数据库的Java API。在SAP PI/PO中配置JDBC有以下几个步骤: 1. 创建JDBC适配器对象:在SAP PI/PO的配置模块中,首先需要创建一个JDBC适配器对象。这个对象将用于定义与数据库的连接和操作。 2. 配置数据库连接参数:在JDBC适配器对象中,配置数据库连接参数。这包括数据库类型、数据库主机名、端口号、数据库实例名称、用户名和密码等。这些参数将被用于建立与数据库的连接。 3. 定义查询或操作:在JDBC适配器对象中,定义要执行的查询语句或数据库操作。这可以是一个SQL查询、插入、更新、删除等。 4. 配置输入和输出参数:为查询或操作定义输入和输出参数。输入参数可以是查询条件,而输出参数可以包含从数据库中检索的数据或操作结果。 5. 测试和部署:在配置完成后,可以进行测试以确保JDBC适配器正常工作。在测试过程中,可以提供输入参数并检查输出结果。一旦测试通过,可以将配置部署到运行时环境中。 通过配置SAP PI/POJDBC适配器,可以实现将SAP系统与其他数据库系统(如Oracle、Microsoft SQL Server、MySQL等)进行集成。这样可以实现数据交换、数据同步、数据转换等功能,提高系统之间的数据共享和流程集成的效率。
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

SAP爱好者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值