# Error writing blob to sqlserver

**URL:** <https://www.ruby-forum.com/t/error-writing-blob-to-sqlserver/86501>\
**Category:** Rails\
**Created:** [February 22, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/error-writing-blob-to-sqlserver/86501 "2007-02-22T20:20:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marlon\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Marlon\_M](https://www.ruby-forum.com/u/Marlon_M)\
**Post date:** [February 22, 2007, 8:20pm UTC](https://www.ruby-forum.com/t/error-writing-blob-to-sqlserver/86501/1 "2007-02-22T20:20:38Z")

</div>

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,  
')

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

---

<div class="post-metadata">

**Author:** ![Marlon\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Marlon\_M](https://www.ruby-forum.com/u/Marlon_M)\
**Post date:** [February 22, 2007, 8:45pm UTC](https://www.ruby-forum.com/t/error-writing-blob-to-sqlserver/86501/2 "2007-02-22T20:45:40Z")

</div>

Marlon M. \<marlon.moyer@…\> writes:

> ([account], [invoice\_date], [id], [pdf]) VALUES(‘BY0905001’, '20060912  
> 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](http://weblog.rubyonrails.org/2007/1/5/rails-1-2-release-candidate-2) and  
at  
the bug report at [http://dev.rubyonrails.org/ticket/6436](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

---

<div class="post-metadata">

**Author:** ![Marlon\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@Marlon\_M](https://www.ruby-forum.com/u/Marlon_M)\
**Post date:** [February 22, 2007, 9:25pm UTC](https://www.ruby-forum.com/t/error-writing-blob-to-sqlserver/86501/3 "2007-02-22T21:25:45Z")

</div>

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

On 2/22/07, Ron P. wrote:

> > the largest, nor the smallest. Everytime I try to run the app on  
> > I’ve tried using the DBD:ADO connection and the DBD:ODBC connection,  
> > at
> 
> >

–
