ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Per Magne Bjornerud" <PMBjorne...@interlect.co.jp>
Subject Error checking data in CSV files
Date Fri, 15 Sep 2006 07:29:25 GMT

I have a question regarding CSV files as a data source. So far, I'm able
to connect and load data fine, but I am expecting some trouble further
down the road: The CSV files are to be uploaded by the user, and needs a
through error checking. Basically, the files can have any problem; too
many commas, wrong data types or anything else.

If there are some serious errors in my data files, the data loading just
fails with some very generic messages. At a minimum, I would need to
know at what line of the CSV file the error happened, and I would also
need to go through the file and find all lines with invalid data, as
fixing errors one by one would take too long time.

What I want, would be iBatis working pretty much as it does right now,
except that it would give me a list of error messages and the line
number of each error instead of just an exception.

Is there any clever approach that might give me what I'm looking for?
Any smart ways of validating CSV data and make iBatis make 999 objects
and an amazing error message for the single line that failed?
If not, it seems that the only way to get this to work is by writing my
own CSV parser by hand, ditching both the CSV driver as well as the
iBatis mapper. Which would be a bit annoying (But I'll live. At least I
iBatis will insert my objects into the SQL DB after I've parsed them
from CSV, phew!)

My issues are maybe more related to ODBC and the "Microsoft Text Driver"
that iBatis, but maybe someone here have any ideas, so I hope you don't
mind me asking :)

Per Magne Bjornerud

View raw message