on 11-02-2016 11:37 AM
Hello SAP gurus
We have a requirement wherein payload comes into PI and has to be sent to an MSSql store procedure as a single string (Blob).
Also, I need to know where will I be configuring the details of store procedure. I couldn't find the right field to use in the JDBC Receiver configuration screen in the iflow.
Your help will be highly appreciated.
Thanks
Ram
Hi Ram!
Since BLOB data types are stored in DB as hexademical strings, first, you should convert your input payload into hex string. You can do it using Apache Commons Codec or using own java code, for example:
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for ( int j = 0; j < bytes.length; j++ ) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
Further you define JDBC document format for calling stored procedure:
<?xml version="1.0" encoding="UTF-8"?>
<MT_JDBC_Call_SP>
<Statement_SP>
<storedProcedureName action="EXECUTE">
<table>SP_name</table>
<Parameter_name type="VARBINARY">Hexademical payload representation</Parameter_name>
</storedProcedureName>
</Statement_SP>
</MT_JDBC_Call_SP>
Regards, Evgeniy.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.