# Activerecord - mysql blobs

**URL:** <https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515>\
**Category:** Rails\
**Created:** [March 21, 2006, 7:53pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515 "2006-03-21T19:53:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![barinek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@barinek](https://www.ruby-forum.com/u/barinek)\
**Post date:** [March 21, 2006, 7:53pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515/1 "2006-03-21T19:53:37Z")

</div>

I’m struggling with activerecord and mysql blobs (uploading files)…

blobs over 400K-ish cause the below exception…

ActiveRecord::StatementInvalid in File#upload

Mysql::Error: Lost connection to MySQL server during query:

I’ve tried blob, mediumblob, and longblob…

I’m using windows xp for development - and have not installed the mysql  
gem…

simlar google postings/solutions have not worked

thoughts/suggestions?

---

<div class="post-metadata">

**Author:** ![barinek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@barinek](https://www.ruby-forum.com/u/barinek)\
**Post date:** [March 21, 2006, 9:09pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515/2 "2006-03-21T21:09:08Z")

</div>

Suggestion to use file\_column… Sorry if you can’t do this… I’m pretty  
sure any DB expert will say you storing blobs in database must suck.

---

<div class="post-metadata">

**Author:** ![barinek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@barinek](https://www.ruby-forum.com/u/barinek)\
**Post date:** [March 21, 2006, 9:13pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515/3 "2006-03-21T21:13:56Z")

</div>

I’m fighting the exact same issue right now myself - so very  
interested in seeing if someone comes back with an answer for it.

I did find some old posts here in the mailing list that suggest that  
error has to do with some buggy mysql bindings in windows and pointed  
to this page

[http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32/](http://wiki.rubyonrails.org/rails/pages/HowToUseMySQLRubyBindingsOnWin32/)

i installed the dll bu haven’t gotten it to work yet. Was also going  
to try porting the code over to my linux webserver either tonight /  
tommorow to see if the problem does go away once it’s off of XP.

---

<div class="post-metadata">

**Author:** ![barinek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@barinek](https://www.ruby-forum.com/u/barinek)\
**Post date:** [March 22, 2006, 10:22pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515/4 "2006-03-22T22:22:56Z")

</div>

Update - looks like I was able to solve my issue by merely increasing  
the mysql max\_allowed\_packet parameter.

hopefully that’ll solve yours too

-Eldon

---

<div class="post-metadata">

**Author:** ![barinek](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c5a1d2/32.png) [@barinek](https://www.ruby-forum.com/u/barinek)\
**Post date:** [March 23, 2006, 4:06pm UTC](https://www.ruby-forum.com/t/activerecord-mysql-blobs/55515/5 "2006-03-23T16:06:37Z")

</div>

very cool - that worked…

- Barinek
