The preceding section demonstrated how to monitor for data and then insert it into the database. However, if a record failed to be inserted, nothing stops that record from being lost to us forever. Yes, you could look in the Application log, but this is tedious and not a very good solution. Therefore we are going to add some extra validation, logging, and notification.
First we need to create a directory to store our records that fail to get inserted. In the same directory as our incoming directory, add a directory called ProcessError. This is where we will store our records that fail.
You can store the failed records two ways:
Create a file per failed record.
Create one file and add all failed ...