Unable to insert flat file values to oracle database


Im having a flat file as follows:

field_id,reg_date,update_date,first_name… etc(Header)

“3432”,“1222010”,“10022009”,“xyz”… (values)

I dont want to insert the header part to database, only values should be inserted.Im using a insert adapter service. Please reply. Im very new to web methods :confused:

When reading the records from the flat file, skip the first record. You’ll need to do that yourself as (oddly) the flat file services do not provide a flag for us to indicate we want the first record skipped.

Thanks for replying for ma post.

when i insert these values into oracle DB, only null values are getting inserted. Is there any thing wrong with the adapter service that im using?

I forgot to mention one thing…

when i read the flat file im getting values wit spaces

Eg: “3 4 4 2” “x y z” (Actual value “3442” “xyz”)

and some times boxes in place of those spaces :frowning:

To know if something is amiss with the adapter service or the caller, we’d need to see details of both.

The character encoding of the file is probably the reason you’re seeing spaces and non-printable characters. What encoding is used by the file and which encoding is specified in the convertToValues or bytesToString call? The default encoding of the JVM is UTF-8. If the file is not UTF-8 encoded or the JVM default encoding has been changed, then the conversion of the bytes to string will not function properly.

Thanks again :). Encoding problem is solved.

can u tell me how can i get rid of the first record in flat file? The header part… (In detail) should i do a manual mapping?? Please help :confused:

You’ll need to skip the first record in your code. If you set flags/addRecordCount to true in the convertToValues call each record will have a @record-count attribute that you can check. The count starts at 1, so branch on that and skip.

Problem solved… Thanks a ton :slight_smile:

If you are using the flat file adapter and parse the data using a flat file schema you may as well define a hierarchic structure with one header rcord (identified by any of the header fields as I assume those are fix) and default records (recordWithNoId) as childs. You can then map only the child records to your targ (or interim) structure.
I prefer this solution for my own integrations because this way the structure of the file and the omitted record are clearly visible in the schema describing the file.

Thanks for the solution:)