# DRb and MySql

**URL:** <https://www.ruby-forum.com/t/drb-and-mysql/109244>\
**Category:** Ruby\
**Created:** [July 12, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/drb-and-mysql/109244 "2007-07-12T17:25:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [July 12, 2007, 5:25pm UTC](https://www.ruby-forum.com/t/drb-and-mysql/109244/1 "2007-07-12T17:25:59Z")

</div>

Hai  
I have created one server using DRb  
That server will run 24x7 and i am using MySql Database  
Its running perfectly,some times it will get lose the  
database and gives the error message  
Database gone away  
I dont know why this problem occurs  
Can any body tell me the solution  
Thank You  
Bye  
By  
P.S.Hussain

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [July 13, 2007, 6:32pm UTC](https://www.ruby-forum.com/t/drb-and-mysql/109244/2 "2007-07-13T18:32:04Z")

</div>

On Jul 12, 2007, at 08:26, Mohamed H. wrote:

> Hai  
> I have created one server using DRb  
> That server will run 24x7 and i am using MySql Database  
> Its running perfectly,some times it will get lose the  
> database and gives the error message  
> Database gone away  
> I dont know why this problem occurs  
> Can any body tell me the solution

MySQL will drop the connection after a certain period of inactivity.

---

<div class="post-metadata">

**Author:** ![pshussain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e9c0ed/32.png) [@pshussain](https://www.ruby-forum.com/u/pshussain)\
**Post date:** [July 14, 2007, 1:45am UTC](https://www.ruby-forum.com/t/drb-and-mysql/109244/3 "2007-07-14T01:45:04Z")

</div>

On 7/13/07, Eric H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> MySQL will drop the connection after a certain period of inactivity.

True, also make sure that you are using C version of mysql bindings.

Also often to handle dropped connections people take following apporach:

1. Have a base class that abstracts database connection pooling and  
stuff and make sure that you handle the exception in this class and  
reconnect to db.
2. Some libs, use a thread that keeps pinging mysql db with some dummy  
query so that mysql doesn’t drop the connection.

* * *

Let them talk of their oriental summer climes of everlasting  
conservatories; give me the privilege of making my own summer with my  
own coals.
