JDBC Adapter Quoting of String

Hi everybody!
I am posting data to a JDBC Receiver adapter using the JDBC adapter's XML format. I have configured the logging of the adapter to show the SQL commands issued to the adapter, since I received some strange errors from the database.
I now find entries like:
INSERT INTO  xxx (field1, field2, field3) VALUES (value1, , value3)
Notice the "missing" value2 - the field's value is a space character (" "). However, I actually wanted to quote the values in this field, since this SQL command of course gives a syntax error because of the two consecutive commas...
How can I quote strings in this SQL command?
Regards, Joerg

Hi,
I don't know if I stated my problem clearly enough... Here is the XML document I post to the JDBC adapter:
<root>
  <insert>
    <xxx action="INSERT">
      <field1>value1</field1>
      <field2> </field2>
      <field3>value1</field3>
    </xxx>
  </insert>
</root>
(note the blank character for field2's value). If I understand your answer correctly, I should use the following instead:
<root>
  <insert>
    <xxx action="INSERT">
      <field1>'value1'</field1>
      <field2>' '</field2>
      <field3>'value1'</field3>
    </xxx>
  </insert>
</root>
This is somewhat inconvenient, since there might be <b>NULL</b> values as well and I'd have to code manymany <b>if</b> statements and <b>mapWithDefaults</b>, then. I was wondering if there is something like the config setting "Interpretation of Empty String Values" for NULL values, some switch I set globally in order to <i>always</i> quote a string...
Regards,  Joerg

Similar Messages

  • (JDBC)how to diffrenciate a single quote in string ? eg : 'Micheal's Store'

    Hi all,
    I wanted to difrrenciate a single quote in string. Is there any way to do so ?
    I'm using Java.
    Thanks

    If you're using Java, I assume you're using straight JDBC rather than one of the many APIs layered on top of JDBC.
    You should be using PreparedStatement objects with bind variables and you should be passing in string values by making appropriate setString() calls. When you're using bind variables, rather than building up SQL strings in your app, you won't have any issues with escaping quotes. You also won't have to worry about defending against SQL injection attacks and your application will perform much better since you won't be re-parsing the same statement over and over and won't be flooding your library cache with thousands of mostly identical statements.
    Justin
    I intended to say that you won't be flooding your shared pool with thousands of mostly identical statements, not the library cache.
    Message was edited by:
    Justin Cave

  • Table name in Receiver JDBC Adapter

    Hi All,
    I am using receiver JDBC adapter.
    But table name consist of " like BPC."#II" .
    After mapping table name becomes BPC.&quot;#II&quot; .
    I am getting error while pulling data from DB.
    Is the table name creating a problem.
    Please remedy of this if you have come across such scenario.
    Regards
    Piyush

    Hi Piyush,
    All that i could get from the SAP Help regarding JDBC Adapters are these links where i never found anything much regarding the table name.anyways just go through these links and see if you find anything useful.
    http://help.sap.com/bp_bpmv130/Documentation/Planning/XIUnicodeGuide030411.pdf
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm">Configuring the Receiver JDBC Adapter</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm">Mapping Lookups</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/content.htm">JDBC Adapter</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/64/ce4e886334ec4ea7c2712e11cc567c/content.htm">Configuring the Receiver JDBC Adapter - part 2</a>
    This is all i got from the help files, anyways you can also go through those links and see if you find anything else useful.
    - Escape Symbol for Apostrophe
    The apostrophe character (‘) is a reserved character in SQL syntax and is therefore replaced by an escape character if it occurs within value strings. This replacement character can be database-specific. Typical replacement characters are \’ or ’’(default value). If a character occurs that is invalid for the database being used, the adapter triggers an error message (an SQL exception) concerning the SQL syntax that is generated by the database.
    - Column Name Delimiter
    Depending on the database being used, column names can be enclosed by a special delimiter character, for example, if the names can contain special characters (such as ”). This character can be specified at this point. The default setting is no delimiter character. If a character occurs that i
    Also check if there are notes in the service market place related to the same.
    Regards,
    abhy
    Message was edited by: Abhy Thomas

  • JDBC adapter , problem in inserting Korean Charaters in MS SQL

    Hi ,
    We are facing a problem when we are inserting "Koren Charaters" in DB of type MS SQL using JDBC adapter.
    What we tryed is:
    We found that there is a problem in Code Page Conversion.  We tried adding a Modules in Receiver Adapter of type JDBC.
    Processing Sequence:
    AF_Modules/XMLAnonymizer--Bean Local Enterprise Bean 1
    AF_Modules/TextCodepageConversionBean-Bean Local Enterprise Bean-- 2
    CallSapAdapter----
    Local Enterprise Bean     -- 0
    Module Configuration:
    1 anonymizer.encoding UTF-16
    2 Conversion.charset  UTF-16.
    But we are getting the error in CC as:
    "Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: ERROR occured parsing request:com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) feff, 3c, feff(:main:, row:2, col:6)(:main:, row=2, col=6) -> com.sap.engine.lib.xml.parser.ParserException: XMLParser: No data allowed here: (hex) feff, 3c, feff(:main:, row:2, col:6)"
    also should I have to check any patches related to JDBC driver from MS SQL which supports korean Code Page?
    Any one who had face this problem pls give us inputs:
    Thanks
    Shankar

    Hi
    In the XML sent to the channel you will have to use a special quoting
    for any Unicode strings, which the JDBC Adapter will not produce on its
    own. Instead, you need to add an attribute 'hasQuot="no"' to those
    elements (most likely in the mapping where you produce the XML) and
    explicitly enclose the data in single quotes prefixed with the letter N.
    For clarity, one example:
    If your original "INSERT" operation looks like this:
    <StatementName2>
    <dbTableName action="INSERT">
    <table>realDbTableName</table>
    <access>
    <col1>val1</col1>
    <col2>val2</col2>
    </access>
    </dbTableName>
    </StatementName2>
    and "col1" contains Unicode data, change the document as follows:
    <StatementName2>
    <dbTableName action="INSERT">
    <table>realDbTableName</table>
    <access>
    <col1 hasQuot="no">N'val1'</col1>
    <col2>val2</col2>
    </access>
    </dbTableName>
    </StatementName2>
    Regards
    Shankar

  • How to insert a NULL value in SQL using JDBC Adapter

    Hi All,
    I have a File -> JDBC scenario.
    In the File and in the SQL table  I have a column called "MR_DATE" that needs to be mapped
    I have to do the following:
    If MR_DATE is NOT equal to "00000000"
             then pass MR_DATE to SQL table
    else
              set the MR_DATE column in the table as NULL.
    Please suggest
    regards,
    Piyush

    Hi Piyush,
    In the receiver JDBC adapter select the option Interpretation of Empty String Values as NULL.
    Pass date as empty, it will be interpreted as NULL by adapter and inserted in database.
    Regards,
    Gautam Purohit

  • Calling a Stored Procedure with JDBC Adapter ?

    I'm trying to call a Stored Procedure in my XI 3.0 JDBC adapter, but I get an "...invalid number of parameters...." error.
    Does anyone have an example of a Query SQL Statement and the corresponding Stored procedure?
    This is my test code. Eventually I would like to return a resultsett from the stored procedure.
    Query SQL Statement:
    call Sp_sapxi( 'F1' , 'xx' )
    Stored Procedure:
    CREATE OR REPLACE PROCEDURE Sp_sapxi (
      transtype_in IN      xi_flaggtest.TRANSTYPE%TYPE,
      status_in    IN      xi_flaggtest.STATUS%TYPE)
    IS
    BEGIN
      UPDATE xi_flaggtest
                 SET status = status_in
               WHERE transtype = transtype_in;
    END;
    Regards,
    Elling

    you can clear the field key tags mandatory in the XML Schema interpreter parameter and make the Empty string value to Empty string from null value.
    For mapping : you can pass a value that is of the same format of date; but you can take your own value in the database since you are parsing the date format from one to other
    thanks
    nikhil

  • Problem in JDBC Adapter Mapping

    Hi all,
    I am working on a scenario wherein i am trying to connect an ORACLE DB to SAP 4.7 system using XI 3.0 . I configured the JDBC Adapter and the JDBC adpter is picking up the message but i have a problem in JDBC adpter Mapping.
    The error message is like this:
    <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
      <SAP:Category>Application</SAP:Category>
      <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code>
      <SAP:P1>com/sap/xi/tf/_ORACLE_MSGMAP_</SAP:P1>
      <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2>
      <SAP:P3>RuntimeException in Message-Mapping transformatio~</SAP:P3>
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>During the application mapping com/sap/xi/tf/_ORACLE_MSGMAP_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>
      <SAP:Retry>M</SAP:Retry>
      </SAP:Error>
    How to map the "Resultset" from the Adapter to a target message? Can anybody throw some light on how to get the message from the JDBC adpter and map it to some other message format...Any documents regarding this ?
    Waitin for ur replies...
    Bye,
    Romit Shankar Arun.

    Hi,
    Does your other SDN post "Inserting data through JDBC adapter" refer to the same problem?
    I assume you use XMLSPY for creating XSDs.
    I used the XSD posted by you in the other forum thread and tried to generate the XML structure and it does not seem to generate the XML structure in the format required by the JDBC adapter.
    sample file generated from your XSD posted in the other forum thread:
    <?xml version="1.0" encoding="UTF-8"?>
    <resultset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="C:\Untitled1.xsd">
         <row action="INSERT">
              <CUSTOMER_NUMBER>String</CUSTOMER_NUMBER>
              <COUNTRY_KEY>String</COUNTRY_KEY>
              <FIRST_NAME>String</FIRST_NAME>
              <LAST_NAME>String</LAST_NAME>
              <AUTHORIZATION_GROUP>String</AUTHORIZATION_GROUP>
              <INDUSTRY_KEY>String</INDUSTRY_KEY>
              <ACCOUNT_GROUP>String</ACCOUNT_GROUP>
              <INTIAL_CONTACT>String</INTIAL_CONTACT>
              <COMPANY_CODE>String</COMPANY_CODE>
              <CITY>String</CITY>
              <CITY_CODE>String</CITY_CODE>
              <COUNTRY_CODE>String</COUNTRY_CODE>
              <DISTRICT>String</DISTRICT>
              <FAX_NUMBER>String</FAX_NUMBER>
              <HOUSE_NUMBER>String</HOUSE_NUMBER>
              <POSTAL_CODE>String</POSTAL_CODE>
              <REGION>String</REGION>
              <TELEPHONE_NUMBER>String</TELEPHONE_NUMBER>
         </row>
    </resultset>
    Compare the above to the template i have mentioned.
    Hope this helps.
    Regards,
    Sridhar

  • How to handle BLOB field in receiver JDBC adapter into ABAP table

    Dear Experts,
    I am working in a synchronous scenario with Sender ABAP Proxy to Oracle Database as receiver via SAP PO 7.4.I will be calling a stored procedure view with fields ID, NAME,Age,*** and BLOB (Image binary).
    1. The response from Oracle Database field BLOB is to be stored in ABAP table.Would I have to write any JAVA program to read the BLOB or the receiver JDBC adapter will handle it and store in a table by using ABAP proxy once it reaches ECC.
    2. If yes, would the JAVA program have to deal with other 4 fields.
    3. Can I use a UDF mapping to this BLOB field.
    Regards
    Rebecca...

    Dear Praveen,
    Thanks for your response...
    Please correct me if I am wrong.
    1. For 1-1 response mapping for BLOB field, I will use just use the below UDF code.
    public static byte[] hexStringToByteArray(String s) { 
                int len = s.length(); 
                byte[] data = new byte[len / 2]; 
                for (int i = 0; i < len; i += 2) { 
                            data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) 
                                                                                         + Character.digit(s.charAt(i+1), 16)); 
                return data; 
    2. ===Using the byte data, create binary attachment in mapping for abap proxy response===
    Could you please share how to create the binary attachment.. I am not clear
    Regards...

  • JDBC-Adapter-Receiver Calling Stored Procedure with Input-Typ Record

    Hallo,
    I´ m trying calling a stored-procedure with two input-parameter; one of typ record (oracle) and one of type tabel of records. Is this possible (I think there are only types like string, integer etc. possible)? When not is there another possibility to work with that type?
    Thanks in advance,
    Frank

    Hi Frank,
    I think stored procedures will not take Array of Records as a Input. If you want to make a loop funtionality etc then JDBC adapter will work accordingly. You need to just call the stored procedure from the JDBC adapter. It will work for the array of records(multiple occurences).
    Receiver JDBC Procedures.
    /people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Alternative option is you can make use of Java Proxy and from there you can call stored procedure ..I think it is possible.. not tried.
    Hope this helps
    Regards,
    Moorthy

  • Receiver JDBC Adapter testing?

    Hi
    Can any one tell me ..how do I test specific adapter w'ther it is connected or not?
    I have cross checked using adapter monitor, my jdbc adapter doesn't showing specific error(red) or success(green),in same JDBC monitor remainig channels showing all information..i thought it unable to connect?Am I correct?
    Did i do any specific settings in JDBC receiver communcication channel?
    I left default settings as it is in CC..
    after giving driver details...i left default settings ..
    1. Interpretation of empty string values = Null value
    2. Persistance          = Local
    3. Conflict resolution  = Redo
    and my datatype structure like this:
    <StatementName>
    <table>Payment_ReceiptFromSAP</table>
    <dbTableName action=”INSERT”>
    <access>
    <col1>ComapnyCode</col1>
    <col2>PaidDate</col2>
    <col3>PaidAmount</col3>
    </access>
    </dbTableName> 
    </StatementName>
    mapping is working fine, tested! RFC sender channel working fine, picking the data from SAPR/3.
    SXMB _MONI -- I haven't find any payload ..why? I thought if RFC is picking the daata properly then XI will hold that data into integration server?..how do i find this data?
    It would be appriciated and rewarded , if you make me clear in this situvation..thanks in advance.!
    Regards..rambarki!

    hi,
    >>I have cross checked using adapter monitor, my jdbc >>adapter doesn't showing specific error(red) or >>success(green),in same JDBC monitor remainig channels >>showing all information..i thought it unable to connect?Am >>I correct?
    you will see in adapter monitoring only after the first time the call is made, the bean in generated and you will be able to see in atapter monitoring.
    >>SXMB _MONI -- I haven't find any payload ..why?
    is ur scenaio synchronous?? if so then make sure you have logging set in sxmb_adm
    Configuration -> Integration Engine Configuration -> Change Specific Configuration Data.
    Category : Runtime
    Parameter : LOGGING_SYNC
    value : 1 (activated)
    Cheers,
    Naveen

  • JDBC Adapter configuration not initialized:null

    i
    we have a synchronous scenario with the following adapters , RFC <> XI <> JDBC.
    1.JDBC Driver installation is done
    2.RFC Destination type t is done in sap(sender) system.
    3.checking the jdbc in VA is done
    while running it is giving the following error.
    com.sap.aii.af.ra.ms.api.RecoverableException: JDBC Adapter configuration not initialized: null
    where we have to initialize JDBC Adapter configuration
    Thanks in advance
    Prasad Nemalikanti

    hi prasad
    There are 2 jar files that may be missing from your SQL JDBC driver --> msbase.jar and msutil.jar, I think once you add these to the driver it might work.
    also check  the driver string for the SQL  driver 2 parameters
    i.e 'com.microsoft.jdbc.sqlserver.SQLServerDriver' now becomes
    'com.microsoft.sqlserver.jdbc.SQLServerDriver'
    This will solve your problem
    follow this link
    Re: MS SQL Server jdbc Driver installation on XI .
    XI JDBC Adapter using stored procedures
    thanks
    sandeep
    Reward points if helpful

  • JDBC adapter: greek characters

    Hi All,
    We are reading and sending data from a ms sql dbase towards our R/3 system via PI (JDBC adapter).
    I am having some problems related with exotic characters (greek). Reading these characters from the dbase works fine without any additional config, but writing these characters gives problems.
    When I check the message logging inside XI, the characters look fine, but the result in the dbase is not.
    ex:
      XI       = Martine &#913;&#932;&#932;&#921;&#922;&#927; &#920;&#917;&#929;&#913;&#928;&#917;&#933;&#932;&#919;&#929;&#921;&#927;
      dbase = Martine ?????? T???????????
    I already tried changing the charset of the communication channel to "iso-8859-7", but that did not fix the problem.
    Anyone an idea?
    Kindest regards
    Joris

    In note 831162 (FAQ: XI 3.0 / PI 7.0 JDBC Adapter) is mentioned:
    "2. Unicode Handling
    Q: I am inserting Unicode data into a database table or selecting Unicode data from a table. However, the data inserted into or retrieved from the table appears garbled. Why doesn't the JDBC Adapter handle Unicode correctly?
    A: While the JDBC Adapter is Unicode-aware, many JDBC drivers and/or database management systems aren't by default and need a codepage or Unicode-awareness to be configured explicitly. For the respective JDBC drivers, this codepage setting is often configured via the driver URL. For details, refer to the documentation of your JDBC driver or database management system.
    Note: For the Lotus Domino Driver for JDBC, there does not seem to be any documented method to enable support for Unicode strings."
    Does this help you?
    Regards
    Stefan

  • File to JDBC Adapter

    Hi All
    I am trying to configure File to JDBC Adapter to insert data in the database .I am having problem with message mapping.I  get the error with the statement field in mapping .Please can anyone let me know what mapping changes need to be done
    My Mapping is as follow
    SOURCE                                                          TARGET
    MT_INFO_DATA----
    >MT_JDBC_REC
    Header----
    > Statement
                                                               TABLENAME
    Update_insert----
    >Action
      T_EMPLOYEE(TABLE NAME)----
    > TABLE
                                                                   ACCESS
    EMP_NO----
    >EMP_NO
    COMP_ID----
    >COMP_ID
    BRANCH----
    >BRANCH
    Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_EMPLOYEE' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR document format: structure 'STATEMENT', no key element found
    Please can anyone let me know what is to be mapped with the field STATEMENT.
    Thanks
    Amit

    Hi Bhavesh
    I did as suggested but still i am getting the following error
    Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_EMPLOYEE' (structure 'STATEMENT'): java.sql.SQLException: ORA-01861: literal does not match format string
    - 2007-05-24 06:21:17 IST: Processing started
    - 2007-05-24 06:07:48 IST: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_EMPLOYEE' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR document format: structure 'STATEMENT', no key element found
    - 2007-05-24 06:07:48 IST: Processing started
    - 2007-05-24 06:05:48 IST: Error: TransformException error in xml processor class: Error processing request in sax parser: Error when executing statement for table/stored proc. 'T_EMPLOYEE' (structure 'STATEMENT'): java.sql.SQLException: FATAL ERROR document format: structure 'STATEMENT', no key element found

  • We get "uFF06uFF03x0;" from sender JDBC adapter

    Thank you.
    This is naoki kurihara.
    We have a problem in sender JDBC adapter.
    We use java mapping and sender JDBC adapter in PI7.1 on Windows.(DB is sqlserver)
    and we test the interface and we found error.
    the reason is to get "&#x0;" from JDBC adapter.
    and our java mapping can't parse it. and we got error.
    the column is not null.
    how we can prevent "&#x0;",
    (sorry I cant write "&#" 1byte word, so I wrote 2bytes word)
    please give me your help!!
    Thanks

    Hi,
    Replace the & character with &amp ; in your java mapping. The same goes for these special characters:
    < with &lt ;
    > with &gt ;
    " with &quot ;
    ' with &apos ;
    Please remove the space between the escape character and the ; in your Java mapping. The spaces are typed here because the equivalent characters are not displaying correctly.
    It should be able to handle the # though. Hope this helps
    Regards,
    Mark

  • Problem whit jdbc adapter

    hello,
    a very big problem.
    I configured in my PI 7.1 installation a JDBC - PI - rfc interface.
    When i active the jdbc comunication channel , all cpu saturated and j2ee crash.
    I try to restart java stack but is not possible
    I think the problem is on jdbc adapter but i cannot stop it if java part is down.
    There are solution for stop or delete this comunication channell from abap stack?
    does someone already had a similar problem that jdbc adapter generate a crash of system?
    thanks

    >
    Alessandro Pederiva wrote:
    > ok thanks, we try
    > which is the correct connection string for connection on SQL server??
    > i used :
    >
    > driver:             sun.jdbc.odbc.JdbcOdbcDriver
    > connection :    jdbc:odbc:Driver={SQL Server};Server=host;Database=dbname
    Are you using a JDBC-ODBC bridge type driver, I am not sure if this is supported by JDBC adapter.....
    If it is not try this,
    Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection: jdbc:microsoft:sqlserver://SQLHOSTNAME:PORT;DatabaseName=DBNAME;SelectMethod=cursor

Maybe you are looking for