# DB persisted attachments?

**URL:** <https://www.ruby-forum.com/t/db-persisted-attachments/97725>\
**Category:** Ruby-Forum\
**Created:** [July 10, 2006, 3:15am UTC](https://www.ruby-forum.com/t/db-persisted-attachments/97725 "2006-07-10T03:15:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e79b87/32.png) [@rocket](https://www.ruby-forum.com/u/rocket)\
**Post date:** [July 10, 2006, 3:15am UTC](https://www.ruby-forum.com/t/db-persisted-attachments/97725/1 "2006-07-10T03:15:59Z")

</div>

Has anyone implemented attachments persisted in the database? The latest  
version of RForum supports file-based attachments that will not work in  
a load balance environment without some drive sharing magic.

Rocket

---

<div class="post-metadata">

**Author:** ![rocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e79b87/32.png) [@rocket](https://www.ruby-forum.com/u/rocket)\
**Post date:** [July 19, 2006, 11:41am UTC](https://www.ruby-forum.com/t/db-persisted-attachments/97725/2 "2006-07-19T11:41:47Z")

</div>

Rocket Johnson wrote:

> Has anyone implemented attachments persisted in the database? The latest  
> version of RForum supports file-based attachments that will not work in  
> a load balance environment without some drive sharing magic.

Can’t you use NFS or something like that? I don’t think that keeping big  
files in a database is a good idea.

---

<div class="post-metadata">

**Author:** ![rocket](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e79b87/32.png) [@rocket](https://www.ruby-forum.com/u/rocket)\
**Post date:** [July 19, 2006, 6:50pm UTC](https://www.ruby-forum.com/t/db-persisted-attachments/97725/3 "2006-07-19T18:50:30Z")

</div>

Andreas S. wrote:

> Rocket Johnson wrote:
> 
> > Has anyone implemented attachments persisted in the database? The latest  
> > version of RForum supports file-based attachments that will not work in  
> > a load balance environment without some drive sharing magic.
> 
> Can’t you use NFS or something like that? I don’t think that keeping big  
> files in a database is a good idea.

NFS is how I solved it initially. However, that solution introduces more  
complexities in a farmed environment. Nothing hard, but with more moving  
parts the more things that can go wrong. Also using a file-based  
persistance mechanism means you have another thing to deal with in your  
backup/restore strategy.

What are your concerns with keeping big files (FYI, I don’t consider  
100k to be big) in a db? Sqlite I can see being a problem but the  
industrial-strength databases handle binary data fine when implemented  
correctly.

FYI, it was pretty simple to switch to db persisted attachments. Also,  
great work on RForum. I have learned a lot about Rails and Ruby using  
it.
