From: Robert Klemme Date: 2007-01-11T07:05:07+09:00 Subject: Re: Undefined Method `free' On 10.01.2007 22:44, Mike Keller wrote: > Gavin Kistner wrote: >> What that means is that on line 27, you are calling "free" on a nil >> object. >> Which means that 'res' is a nil object. >> Which means that db.query(...) is returning nil. > > My question now is what would someone recommend as the best solution for > this. Since it's not a query you do not get anything back. Remove "res" altogether from the code. > If I simply remove the line with res.free it enters the information into > the db 3 times. The reason is that the exception will cause a tx rollback. You need to find out what your DB is doing here. > Am I missing something that is causing it to do this? Possible reasons that come to mind: - data in the file looks different that you think - there is already data in the table - you have some triggers defined that cause the effect You could create a test table with the same structure as the one you are trying to load and test that statement against that table and see what happens (i.e. what you get in that table). I'd say Ruby is the wrong place to look into. Kind regards robert