This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

AnnouncementAnnouncement Module

Collapse

No announcement yet.

how to validate data formate befre pushing in to data base from csv file.Page Title Module

how to validate data formate befre pushing in to data base from csv file.

Jul 6th, 2011, 10:07 AM

Hi,

I have an application which is reading data from csv file and push in to data base. But I want to check the data formate before push in to database. Whether the data formate is correct or wrong. if the data is correct then this should push in to data base. if the data is wrong then this should push in to failed csv file. (please remember the data formate is only data types like int, string, date like that).
Can any body help on this!

I also have the same issue... I need to check first if the data (may it be the type or the format or if there are null elements) before pushing them to the database... At first, I was thinking of reading the file first (separately from the ItemReader) to check and validate the data in the file. But that would mean a wastage of resources (redundancy of reading the file) and it can take a lot longer if the file is so big.

I am trying another approach though: skipping items, instead of dropping the whole job/file, by using SkipListener, and logging the skipped files on an another table on the database.. But I am still configuring and setting it up to work on my project, and I am having a hard time on it. <newbie me! >