# ActiveRecord and Threads

**URL:** <https://www.ruby-forum.com/t/activerecord-and-threads/125008>\
**Category:** Rails\
**Created:** [January 4, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/activerecord-and-threads/125008 "2008-01-04T15:54:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/839c29/32.png) [@jedi](https://www.ruby-forum.com/u/jedi)\
**Post date:** [January 4, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/activerecord-and-threads/125008/1 "2008-01-04T15:54:40Z")

</div>

I do not want to set the concurrency flag in activerecord to true for  
a variety of reasons. My ROR appln has a background thread spawned  
which accesses the DB and send out an email. When this background  
thread is accessing the DB, if a web request comes in ( that calls for  
DB access) then we have 2 threads on the same ActiveRecord connection.  
I dont mind synchronizing the access to the DB. . But not able to find  
where I set that flag…

From a different perspective, I guess Mysql JDBC driver synchronises  
the packet sending over TCP connection, so even if multiple threads  
use the same connection in JAVA you are still safe ( nothing to do in  
application code).

How do I get a similar functionality in ROR.?

Jedi…
