From: Ben Gribaudo Date: 2006-11-07T05:38:10+09:00 Subject: Re: Ruby ODBC SQL Server Errors Hi Luis, I asked Christian Werner about this in the past. He told me that these are internal warnings intended to remind the lazy programmer to close/drop his ODBC statements. If you don't do so, their cleanup doesn't occur until garbage collection. Christian said these warnings are "...not a bug but a feature." Try q.drop after q.execute and see if that fixes things for you.. Ben Luis Lebron wrote: > I have a ruby script that inserts data into a SQL Server Express > database. The inserts work but I keep getting errors like the following > "WARNING: STMT 0x2954f50 was not dropped before garbage collection." > > Here's the script > ========================== > > require 'odbc' > > c=ODBC::connect('SMD') > t1 = Time.now > > aFile = File.open("C://temp/DMERECAP.SDF") > > aFile.each_line do |line| > if $. < 11 > q =c.prepare("Insert into > DMERECAP(recptlo,datepaid,invoicenum,dolapplied,payername,hcpc,servdatepd,patnum) > values ('#{line[0..6].squeeze(" ")}' ,'#{line[7..16].squeeze(" ")}', > '#{line[17..28].squeeze(" ")}', '#{line[29..40].squeeze(" ")}', > '#{line[48..87].squeeze(" ")}', '#{line[88..92].squeeze(" ")}', > '#{line[145..154].squeeze(" ")}', '#{line[138..145].squeeze(" > ").to_i}')") > q.execute() > > end > end > > puts "Import complete." > puts Time.now-t1 > > if c > c.disconnect > end > > ============ > > Any help would be appreciated. > > thanks, > > Luis > >