cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC Error

Former Member
0 Kudos

Hi, i'm receiving the following error on my idoc-xi-jdbc scenario where the sql server is receiver.

Seems like an error on incoming data structure but i couldn't find what the error is,

Error Exception caught by adapter framework: Error 'com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '<'.' executing service raw2sql with SQL statement '<?xml version="1.0" encoding="UTF-8"?> <ns0:MT_StagingProductImport xmlns:ns0="urn://briscoes/TEST/idoctest2"><StatementName1><StagingProductImport action="INSERT"><table>dbo.StagingProductImport</table><access><ProductCode>1</ProductCode><BranchCode>2</BranchCode><Description>4</Description></access></StagingProductImport></StatementName1></ns0:MT_StagingProductImport>'

Error Delivery of the message to the application using connection JDBC_http://sap.com/xi/XI/System failed, due to: com.sap.aii.af.ra.ms.api.RecoverableException: Error 'com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near '<'.' executing service raw2sql with SQL statement '<?xml version="1.0" encoding="UTF-8"?> <ns0:MT_StagingProductImport xmlns:ns0="urn://briscoes/TEST/idoctest2"><StatementName1><StagingProductImport action="INSERT"><table>dbo.StagingProductImport</table><access><ProductCode>1</ProductCode><BranchCode>2</BranchCode><Description>4</Description></access></StagingProductImport></StatementName1></ns0:MT_StagingProductImport>'.

any help is greatly appreciated.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

May be there is some issues with configuration of "XML schema interpretor"

Try unchecking Key tag mandatory and execute your scenario.

No sure if it will work, just give a try.

Satish

Answers (5)

Answers (5)

Former Member
0 Kudos

OK understood now. I was thinking JDBC adapter would be able to differentiate it by the action described Thanks a lot. Can you guys please confirm points received? Not sure if i done it correctly.

Former Member
0 Kudos

I really don't know how this points system works in SDN forum.

But I can comfortably say I got enough points for my reply.

bhavesh_kantilal
Active Contributor
0 Kudos

<i>OK understood now. I was thinking JDBC adapter would be able to differentiate it by the action described :)</i>

It does. Even for Update, Delete etc you need not select the key Fields mandatory in the Receievr JDBC adapter. This is just in case you want to make sure that the entire table does not get updated / deleted ( imagine you try a delete without KEY ) .

Regards

Bhavesh

Former Member
0 Kudos

Bhavesh,

>>This is just in case you want to make sure that the entire table does not get updated / deleted ( imagine you try a delete without KEY ) .

I remember reading documentation, that said such operations are <b>not allowed</b> in JDBC adapter.

If I remeber correctly the statement was, "If you do not have a key tag for update/delete this means you are trying to update/delete the entire table. For security reasons, this is not allowed". Hence I assumed such statements will result in error.

Can you pls clarify this for us...

Thanks,

Jai Shankar

bhavesh_kantilal
Active Contributor
0 Kudos

Exact details from help.sap,

<i>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. <b>This may not be permitted by the configuration of the JDBC adapter for security reasons</b> and will therefore result in an error during message processing and an appropriate error message.</i>

This may not be permitted by Configuration of JDBC adapter --> This is when you select the KEY field mandatory option in the JDBC adapter. if you do not select this the entire table will get deleted / updated . If you do not select this option, message will go through.

Hope it is clear jai .

Regards

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Got that. Thanks again.

Regards,

Jai Shankar

Former Member
0 Kudos

Thank you. Unchecking the "Key tags mandatory" solved it. It is weird thou!.

I will eventually will need to use key fields however, i wonder if its going to cause trouble at a later time.

bhavesh_kantilal
Active Contributor
0 Kudos

Actually it is not weir:-)

Key Fields are used in the case of INSERT_UPDATE when you need to have a WHERE claause in the SQL query.

In your case as youa re attempting just an INSERT , you do not need KEY tag in the XML. But, as you made the JDBC adapter check for it mandatorily it caused an issue. Unchecking it like pointed perfectly by Satish is the correct way for an INSERT .

Regards

Bhavesh

Former Member
0 Kudos

You will not use a Key tag for "Insert".

If its Update, update_insert, delete, select then you may use a Key Tag. may be at that time you can recheck the Key Tags mandatory field and execute your scenario.

Satish

Former Member
0 Kudos

Sorry, now attached these images.

-


<img src='http://www.DigitalUploader.com/1/8095Screencapture_9.jpg'>

-


<img src='http://www.DigitalUploader.com/1/5626Screencapture_10.jpg'>

-


Former Member
0 Kudos
bhavesh_kantilal
Active Contributor
0 Kudos

Unfortunately, Proxy at work blocked the images

Don't ask me why

Regards

Bhavesh

Former Member
0 Kudos

btw, the incoming xml after its mapping is as following;

<?xml version="1.0" encoding="UTF-8" ?>

- <ns0:MT_StagingProductImport xmlns:ns0="urn://briscoes/TEST/idoctest2">

- <StatementName1>

- <StagingProductImport action="INSERT">

<table>dbo.StagingProductImport</table>

- <access>

<ProductCode>1</ProductCode>

<BranchCode>2</BranchCode>

<Description>4</Description>

</access>

</StagingProductImport>

</StatementName1>

</ns0:MT_StagingProductImport>

is there anything wrong with this structure?

bhavesh_kantilal
Active Contributor
0 Kudos

XML looks good.

Can you let us know what are the parameters you have used in the JDBC receievr adapter?

Regards

Bhavesh