From: Jose Montero Date: 2006-09-27T22:21:45+09:00 Subject: Re: Commit when error Paul Lutus wrote: > Jose Montero wrote: > >> And now i have this code that process each line: >> executeQuery method produces an error, the lines 10,000 to 12,000 DONT >> load to the database. Because i commit after 10,000 lines, so those >> 2,000 lines havent got commit. So, what i want is that when the >> executeQuery produces an error, ok, dont load that line, but i want to >> commit the rest of lines that were loaded before. >> I putted the "@dbh.commit" in the rescue block, but doesnt work. What >> can i do? Where should i put a @dbh.commit in my code? > > Why not solve the problem instead of trying to work around it? Why not > commit on each read record, then commit on groups of 100 read records, > gradually increasing the commit interval until you come up with some > clues > to the problem? > > Obviously, once an error condition comes up, trying to commit then is > too > late -- the prevailing error condition prevents the commit from being > carried out. -------------------------------------------------------------------- Well the thing here is that if i commit each 5 records, and i get an error loading the 4th record, those 4 records wont commit, wont load. I think the thing here is how to recover from an error, how to commit the records that were already loaded to the database.....is it possible? Thanks -- Posted via http://www.ruby-forum.com/.