How do I define a field in my flatfile dictionary as something other than String (e.g. Integer)?

I’m using WebMethods 10. I’m using the “pub.flatFile.convertToValues” to parse a CSV file and insert the records into a MySQL database. I defined my dictionary and schema and then ran my service, only to discover the inserts fail because one of my columns is a number and the parsing is treating it as a string.

Then I changed the “Data Type” of the field taht should be numeric to “java.lang.Integer” in my dictionary definition (see screen shot). THen i re-ran my flow service and got the same result … [ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service
ClassCast Exception for field: eid. Error: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

What’s the right way to edit my dictionary/schema so that this particular field is treated as an Integer and not a String?

You can define the FF dico as String and insert the same as String in DB, in the adapter servcie there is an option to insert as String.

Hi Mahesh, Thanks for your reply. The MySql column in question is a numeric column, though. So I would like to define that data type as an Integer (or some numeric value) and not a String. Is that possible? If so, how do I go about changing the dictionary data type?

What I meant was, leave the dico. fields to defaults (i.e, String) and in your Adapter service, you can set the input filed of integer as “SetAsString Data Type in Adapter for JDBC”

Share me the screen shot of Insert Adapter Service I will walk you thru?

Refer the docs “Using the SetAsString Data Type in Adapter for JDBC”

Ah I see! When I did the changes you suggested (changing the field in the batch insert service from Integer to String) then the execution succeeded and all the rows were inserted successfully to my table.


Good! Pls mark the thread “As Answered”.