From: Jose Montero Date: 2006-09-27T01:39:15+09:00 Subject: Commit when error Ok, this is my problem: Im loading around 900,000 records from a file to my database. So, i commit after it has processed 10,000 with something like this: if (count % 10000) == 0 @dbh.commit end (Where the variable count is the number of lines loaded.) And now i have this code that process each line: begin executeQuery(query) rescue $stderr.puts "err: " + $!.to_s @dbh.commit end Here is the problem: For example, if the programm is loading the 12,000 line and this 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? Hope i explained my case clear, Thanks in advance -- Posted via http://www.ruby-forum.com/.