Error writing blob to sqlserver

I've got a rails app that retrieve tif files from the filesystem, creates multi-page pdfs and stores them in an image field in the database. It works great, except for a couple of files. The files it chokes on are anything really different from the others, they're not the largest, nor the smallest. Everytime I try to run the app on these files, I get this error.

DBI::DatabaseError: Not enough SQL parameters: INSERT INTO invoices ([account], [invoice_date], [id], [pdf]) VALUES('BY0905001', '20060912 00:00:00', 13, <binary data has been removed from the email>')

I can see the EOF marker of the pdf file at the very end of the binary data, so I know its sending the whole shebang.

I've tried using the DBD:ADO connection and the DBD:ODBC connection, but both fail in the same way.

Any hints on where to start with this? I don't know if it matters or not, but on the error output there are a lot of single quote characters. I'm assuming they're automatically escaped.

Marlon Moyer <marlon.moyer@...> writes:

I've got a rails app that retrieve tif files from the filesystem, creates multi-page pdfs and stores them in an image field in the database. It works great, except for a couple of files. The files it chokes on are anything really different from the others, they're not the largest, nor the smallest. Everytime I try to run the app on these files, I get this error.

DBI::DatabaseError: Not enough SQL parameters: INSERT INTO invoices ([account], [invoice_date], [id], [pdf]) VALUES('BY0905001', '20060912 00:00:00', 13, <binary data has been removed from the email>')

I can see the EOF marker of the pdf file at the very end of the binary data, so I know its sending the whole shebang.

I've tried using the DBD:ADO connection and the DBD:ODBC connection, but both fail in the same way.

Any hints on where to start with this? I don't know if it matters or not, but on the error output there are a lot of single quote characters. I'm assuming they're automatically escaped.

Look at "Skeeterbug's" comment (#15) at Ruby on Rails — Rails 1.2: Release Candidate 2 and at the bug report at http://dev.rubyonrails.org/ticket/6436

I don't think these are corrected; perhaps that's the problem. I know I couldn't get acts_as_attachment storage :db_system working with SQL Server at all, but it worked just fine with MySQL.

Ron

dang, that’s not the answer I wanted to hear! :slight_smile: