Error While Inserting Data into Database, BPEL Reading Data From CSV File
Friday, January 29, 2010
Symptoms
Using BPEL, reading a CSV file and inserting the data read from CSV file into any database and you notice errors such as below:
Caused by: org.collaxa.thirdparty.apache.wsif.WSIFException:
file:/F:/product/10.1.3.1/OracleAS/bpel/domains/default/tmp/.bpel_LegalBInbound_1.2_a9794a68a9df7003
9198a32c72b8581c.tmp/InsertData_To_F58LEGAL.wsdl
[InsertData-To-F58LEGAL_ptt::insert(F58legalCollection) ] - WSIF JCA Execute of operation 'insert'
failed due to: DBWriteInteractionSpec Execute Failed Exception.
insert failed. Descriptor name: [InsertDataToF58LEGAL.F58legal]. [Caused by: [SQL7008] F58LEGAL in
TNPIDTA not valid for operation.]
; nested exception is:
ORABPEL-11616
DBWriteInteractionSpec Execute Failed Exception.
insert failed. Descriptor name: [InsertDataToF58LEGAL.F58legal]. [Caused by: [SQL7008] F58LEGAL in
TNPIDTA not valid for operation.]
Caused by Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.1.0) (Build 061004)):
oracle.toplink.exceptions.DatabaseException
Internal Exception: java.sql.BatchUpdateException: [SQL7008] F58LEGAL in TNPIDTA not valid for
operation.Error Code: -7008.
at
oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeRequestResponseOperation(WSIFOperation_JCA.j
ava:623)
at
oracle.tip.adapter.fw.wsif.jca.WSIFOperation_JCA.executeInputOnlyOperation(WSIFOperation_JCA.java:72
6)
at com.collaxa.cube.ws.WSIFInvocationHandler.invoke(WSIFInvocationHandler.java:425)
Steps to reproduce
1. Write a simple SQL statement such as:
insert into emp (empno, empname) values(123,'Ranajit,Sahoo')
and try executing the statement with BPEL SQL worksheet.
This should work fine.
2. Create a simple BPEL process with a receive, invoke, database adapter and reply nodes
3. In the database adapter wizard choose simple SQL statement as your option and use the above SQL statement.
4. Click OK in the database adapter wizard, compile, deploy and initiate the process.
You get the ORABPEL-11616 error.
Cause
The problem might be that the CSV file has single quotes around the alphanumeric fields. This problem here has nothing to do with how the database is setup.
According to CSV file standards, BPEL does not count single quotes as the wrapper for the fields. BPEL considers double quotes as the field wrapper.
Example of how BPEL interprets Quotes:
Input ---> output or result
'rs123'---> read as 'rs123'. Not that the single quotes stick with the value.
'rs,123'---> read as 'rs and 123' these are considered to be two different fields.
"rs123"---> read as rs123. Note that the double quotes do not stick with the value.
"rs,123"--->read as rs,123 this is one field, here it does not read the value as tow different fields.
Solution
The solution is not to use single quotes as the field wrapper instead use double quotes to wrap the field, If required in the CSV file.