Skip to Content
0
Former Member
Aug 24, 2009 at 10:09 PM

CSV to JDBC Mapping

61 Views

Hi Experts,

I have a CSV to JDBC scenario.

My sender data type is defined as

dt_sender

row element 1...unbounded

field1 element xsd:string 1...unbounded

field2 element xsd:string 1...unbounded

....

field15 element xsd:string 1...unbounded

My receiver data type is defined as

dt_receiver

statement element 1...1

test element 1...1

action attribute string optional

table element string 1...1

access element 1...unbounded

field1 element xsd:string 1...unbounded

field2 element xsd:string 1...unbounded

....

field15 element xsd:string 1...unbounded

I need to insert the data from the CSV file into the database.

I have done simple graphical mapping. The xml structure for the sender MT is

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

<ns0:MT_sender xmlns:ns0="http://csv2jdbc">

<row>

<field1/>

...

<field15/>

</Row>

</ns0:MT_sender>

When I test the mapping...it executes successfully. In the sender CC, I did filecontentconversion with the parameters

Recordset structure : row,*

row.fieldSeparator : \t

row.endSeparator : 'nl'

row.fieldNames : field1,...,field15

The xml file is being created successfully in the sender CC but is not being dropped into the receiver JDBC.

THe JDBC receiver channel is also connected properly. I know that there is some problem with mapping.

But I am unable to find what the error is. No data is being inserted into the table.

The actual payload from the file is

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

- <ns:MT_sender xmlns:ns="http://csv2jdbc">

- <Recordset>

- <row>

<field1>xxxxxx</field1>

...

<field15>xxxxxx</field15>

</row>

- <row>

<field1>xxxxxx</field1>

...

<field15>xxxxxx</field15>

</row>

- <row>

<field1>xxxxxx</field1>

...

<field15>xxxxxx</field15>

</row>

</Recordset>

</ns:MT_sender>

PS: I did this scenario with the blog available for Flat file to JDBC.

Please help me out finding the error.

Regards.