# Lost connection to MySQL server during query

**URL:** <https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511>\
**Category:** JRuby\
**Created:** [April 14, 2009, 6:13pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511 "2009-04-14T18:13:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 14, 2009, 6:13pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/1 "2009-04-14T18:13:46Z")

</div>

Hi,

I’m trying to run an existing rails app on jruby. When I run:

jruby -S rake db:test:clone

I get the following stacktrace. Right now we’re using rails 1.2.3, but  
I tried this with rails 1.2.6 and 2.0.2:

rake aborted!  
Mysql::Error: Lost connection to MySQL server during query: SHOW TABLES  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/connection\_adapters/abstract\_adapter.rb:128:in `log' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/connection_adapters/mysql_adapter.rb:243:in`execute’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/connection\_adapters/mysql\_adapter.rb:326:in `tables' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/schema_dumper.rb:54:in`tables’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/schema\_dumper.rb:23:in `dump' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/schema_dumper.rb:17:in`dump’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/  
databases.rake:24  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/  
databases.rake:23:in `open' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/ databases.rake:23 /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 617:in`call’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
617:in `execute' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 612:in`each’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
612:in `execute' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 578:in`invoke\_with\_call\_chain’  
/usr/local/jruby/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 571:in`invoke\_with\_call\_chain’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
588:in `invoke_prerequisites' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 585:in`each’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
585:in `invoke_prerequisites' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 577:in`invoke\_with\_call\_chain’  
/usr/local/jruby/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 571:in`invoke\_with\_call\_chain’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
564:in `invoke' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 2027:in`invoke\_task’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
2005:in `top_level' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 2005:in`each’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
2005:in `top_level' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 2044:in`standard\_exception\_handling’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
1999:in `top_level' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 1977:in`run’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
2044:in `standard_exception_handling' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb: 1974:in`run’  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31  
/usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:  
19:in `load’  
/usr/local/jruby/bin/rake:19

Here are the gems I have installed:

actionmailer (2.3.2, 2.0.2, 1.3.6, 1.3.3)  
actionpack (2.3.2, 2.0.2, 1.13.6, 1.13.3)  
actionwebservice (1.2.6, 1.2.3)  
activerecord (2.3.2, 2.0.2, 2.0.1, 1.15.6, 1.15.3)  
ActiveRecord-JDBC (0.5)  
activerecord-jdbc-adapter (0.9.1)  
activerecord-jdbcmysql-adapter (0.9.1)  
activeresource (2.3.2, 2.0.2)  
activesupport (2.3.2, 2.0.2, 2.0.1, 1.4.4, 1.4.2)  
archive-tar-minitar (0.5.2)  
color (1.4.0)  
fastercsv (1.2.3)  
gem\_plugin (0.2.3)  
hoe (1.12.1)  
hpricot (0.6.164)  
htmltools (1.10)  
jdbc-mysql (5.0.4)  
jruby-openssl (0.4)  
macaddr (1.0.0)  
mocha (0.9.5)  
mongrel (1.1.5)  
pdf-writer (1.1.8)  
rails (2.3.2, 2.0.2, 1.2.6, 1.2.3)  
rake (0.8.4)  
rspec (1.2.0)  
rubyforge (1.0.3)  
rubyful\_soup (1.0.4)  
ruport (1.6.1)  
sources (0.0.1)  
transaction-simple (1.4.0)  
uuid (2.0.1)

Any help?

Thanks  
Brendan

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email
```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 14, 2009, 6:31pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/2 "2009-04-14T18:31:23Z")

</div>

Hi,

Sorry I forgot to mention. I am running OSX and have added:

if RUBY\_PLATFORM =~ /java/  
require ‘rubygems’  
gem ‘activerecord-jdbc-adapter’  
require ‘jdbc\_adapter’  
end

to environment.rb as explained in:

> **[GitHub - nicksieger/activerecord-jdbc-adapter: ActiveRecord adapter for JDBC and...](https://github.com/nicksieger/activerecord-jdbc-adapter/tree/master)**
>
> master

Thanks again

On Apr 14, 2009, at 11:46 AM, Brendan Grainger wrote:

> Mysql::Error: Lost connection to MySQL server during query: SHOW  
> /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/  
> 617:in `call' 571:in `invoke\_with\_call\_chain’  
> 571:in `invoke\_with\_call\_chain’  
> /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:  
> /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:  
> ActiveRecord-JDBC (0.5)  
> htmltools (1.10)  
> rubyful\_soup (1.0.4)  
> ruport (1.6.1)  
> sources (0.0.1)  
> transaction-simple (1.4.0)  
> uuid (2.0.1)
> 
> Any help?
> 
> Thanks  
> Brendan

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 6:20pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/3 "2009-04-15T18:20:55Z")

</div>

Don’t suppose anyone has had a similar experience with OSX?

Thanks

On Apr 14, 2009, at 12:30 PM, Brendan Grainger wrote:

> to environment.rb as explained in:
> 
> > `log' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/ rake.rb:617:in `execute’  
> > rake.rb:588:in `invoke_prerequisites' rake.rb:564:in `invoke’  
> > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/  
> > /usr/local/jruby/bin/rake:19  
> > activerecord-jdbcmysql-adapter (0.9.1)  
> > jruby-openssl (0.4)  
> > sources (0.0.1)  
> > transaction-simple (1.4.0)  
> > uuid (2.0.1)
> > 
> > Any help?
> > 
> > Thanks  
> > Brendan

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 8:09pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/4 "2009-04-15T20:09:22Z")

</div>

This happens always, when I run:

jrake db:migrate

Usually when trying to create an index.

Thanks!

On Apr 15, 2009, at 1:59 PM, AD wrote:

> > Don’t suppose anyone has had a similar experience with OSX?
> > 
> > > require ‘rubygems’  
> > > On Apr 14, 2009, at 11:46 AM, Brendan Grainger wrote:
> > > 
> > > > `execute' lib/active_record/schema_dumper.rb:23:in tasks/databases.rake:23:in rake.rb:617:in /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/ `invoke\_prerequisites’  
> > > > rake.rb:577:in
> > > > 
> > > > `each’  
> > > > rake.rb:1999:in  
> > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/  
> > > > Here are the gems I have installed:  
> > > > archive-tar-minitar (0.5.2)  
> > > > mongrel (1.1.5)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 8:55pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/5 "2009-04-15T20:55:46Z")

</div>

can you connect to mysql from the server outside of Jruby ? Can you  
confirm the credentials are correct in database.yml ?

Are you using activerecord-jdbc ?

On Wed, Apr 15, 2009 at 2:08 PM, Brendan Grainger  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > does this happen for every query or just intermittently?
> > 
> > > Don’t suppose anyone has had a similar experience with OSX?
> > > 
> > > > require ‘rubygems’  
> > > > On Apr 14, 2009, at 11:46 AM, Brendan Grainger wrote:
> > > > 
> > > > > `dump' `open’  
> > > > > `execute’  
> > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
> > > > > 
> > > > > `invoke\_with\_call\_chain’
> > > > > 
> > > > > `top\_level’  
> > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in  
> > > > > actionpack (2.3.2, 2.0.2, 1.13.6, 1.13.3)  
> > > > > gem\_plugin (0.2.3)  
> > > > > rake (0.8.4)
> 
> * * *
> 
> To unsubscribe from this list, please visit:
> 
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 8:00pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/6 "2009-04-15T20:00:33Z")

</div>

does this happen for every query or just intermittently?

We had some issues with connections being lost so we had to implement  
DBCP in Tomcat to handle proper connection pooling in case a  
connection died.

Adam

On Wed, Apr 15, 2009 at 12:19 PM, Brendan Grainger  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > if RUBY\_PLATFORM =~ /java/
> > 
> > > `tables' /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:24 `execute’
> > > 
> > > `invoke\_prerequisites’
> > > 
> > > `top\_level’  
> > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in  
> > > Here are the gems I have installed:  
> > > archive-tar-minitar (0.5.2)  
> > > mongrel (1.1.5)
> 
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 9:58pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/7 "2009-04-15T21:58:37Z")

</div>

Answers below:

On Apr 15, 2009, at 2:55 PM, AD wrote:

> can you connect to mysql from the server outside of Jruby ?  
> Yes. In fact I can run the application no problem using the same  
> configuration. It seems only to lose the connection when doing ddl  
> type things like: jrake db:migrate, jrake db:test:clone or running  
> tests (jrake test).

> Can you confirm the credentials are correct in database.yml ?  
> Yes. They work fine if I start up using MRI.

> Are you using activerecord-jdbc ?  
> Yes. Here is the relevant output of jgem list :

activerecord-jdbc-adapter (0.9.1)  
activerecord-jdbcmysql-adapter (0.9.1)

I have the following in my environment.rb

# Only needed for rails 1.2.x

if RUBY\_PLATFORM =~ /java/  
puts  
"**\n  
"  
puts " Running jdbc adapter "  
puts  
"**\n  
"  
require ‘rubygems’  
gem ‘activerecord-jdbc-adapter’  
require ‘jdbc\_adapter’  
end

Thanks again  
Brendan

> > Thanks!
> > 
> > > Adam
> > > 
> > > > > Hi,
> > > > > 
> > > > > > jruby -S rake db:test:clone
> > > > > > 
> > > > > > tasks/databases.rake:23
> > > > > > 
> > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/  
> > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/  
> > > > > > rake.rb:2027:in  
> > > > > > `each’
> > > > > > 
> > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/bin/  
> > > > > > activerecord (2.3.2, 2.0.2, 2.0.1, 1.15.6, 1.15.3)  
> > > > > > hpricot (0.6.164)  
> > > > > > rubyforge (1.0.3)  
> > > > > > Brendan

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 11:44pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/8 "2009-04-15T23:44:54Z")

</div>

## Here it is. Note that running under MRI everything works fine.

defaults: &defaults  
username: blog  
password: blog  
host: localhost  
adapter: mysql  
socket: /var/run/mysqld/mysql.sock # I know this is weird, it’s not  
my fault

# When we use rails \> 2.0 adapter: jdbcmysql

development:  
database: blog\_development  
\<\<: \*defaults

test:  
database: blog\_test  
\<\<: \*defaults

* * *

I know rake db:migrate tries to read the development section by default.

Thanks

On Apr 15, 2009, at 5:31 PM, AD wrote:

> > On Apr 15, 2009, at 2:55 PM, AD wrote:
> > 
> > > Can you confirm the credentials are correct in database.yml ?  
> > > I have the following in my environment.rb  
> > > require ‘rubygems’  
> > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > 
> > > > > [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> > > > > 
> > > > > > > Thanks again
> > > > > > > 
> > > > > > > > 1.2.3,
> > > > > > > > 
> > > > > > > > `execute’  
> > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/
> > > > > > > > 
> > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/
> > > > > > > > 
> > > > > > > > rake.rb:571:in  
> > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/
> > > > > > > > 
> > > > > > > > `standard\_exception\_handling’  
> > > > > > > > rake:19:in  
> > > > > > > > ActiveRecord-JDBC (0.5)  
> > > > > > > > htmltools (1.10)  
> > > > > > > > rubyful\_soup (1.0.4)
> > > > > 
> > > > > * * *
> > > > 
> > > > [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)
> 
> To unsubscribe from this list, please visit:
> 
> [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 15, 2009, 11:32pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/9 "2009-04-15T23:32:34Z")

</div>

can you show me a copy of your database.yml ?

rake db:migrate by default tries to read the “development” section.  
Make sure you either tell db:migrate to use prod or update your  
development section of database.yml.

On Wed, Apr 15, 2009 at 3:57 PM, Brendan Grainger  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> gem ‘activerecord-jdbc-adapter’
> 
> > > > does this happen for every query or just intermittently?
> > > > 
> > > > > Don’t suppose anyone has had a similar experience with OSX?
> > > > > 
> > > > > > require ‘rubygems’  
> > > > > > On Apr 14, 2009, at 11:46 AM, Brendan Grainger wrote:
> > > > > > 
> > > > > > > tried this with rails 1.2.6 and 2.0.2:
> > > > > > > 
> > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/schema\_dumper.rb:17:in
> > > > > > > 
> > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in  
> > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in  
> > > > > > > `each' /usr/local/jruby/lib/ruby/1.8/monitor.rb:191:in `mon\_synchronize’
> > > > > > > 
> > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in  
> > > > > > > `run’  
> > > > > > > actionpack (2.3.2, 2.0.2, 1.13.6, 1.13.3)  
> > > > > > > gem\_plugin (0.2.3)  
> > > > > > > rake (0.8.4)
> > > 
> > > * * *
> > 
> > [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 16, 2009, 4:39pm UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/10 "2009-04-16T16:39:15Z")

</div>

Hi,

Thanks, but if you look at my first post that’s exactly what I did.

Anyway, I seem to have figured it out (cross fingers). I made the  
following changes to my.cnf:

# InnoDB Settings

innodb\_buffer\_pool\_size = 128M  
innodb\_additional\_mem\_pool\_size = 20M

and bingo! No more lost connections. I tried these settings with both  
the disk image from [mysql.com](http://mysql.com) (version 5.1.33) and the macports  
version (version 5.0.75) . Both were failing to db:migrate previously  
on Leopard. Both seem to work now.

Thanks all  
Brendan

On Apr 15, 2009, at 8:43 PM, AD wrote:

> > adapter: mysql  
> > test:  
> > On Apr 15, 2009, at 5:31 PM, AD wrote:
> > 
> > > > Answers below:  
> > > > test).  
> > > > activerecord-jdbcmysql-adapter (0.9.1)  
> > > > puts
> > > > 
> > > > > > > > > to environment.rb as explained in:
> > > > > > > > > 
> > > > > > > > > > SHOW
> > > > > > > > > > 
> > > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/
> > > > > > > > > > 
> > > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/
> > > > > > > > > > 
> > > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/
> > > > > > > > > > 
> > > > > > > > > > lib/rake.rb:578:in
> > > > > > > > > > 
> > > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/
> > > > > > > > > > 
> > > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/
> > > > > > > > > > 
> > > > > > > > > > lib/rake.rb:2044:in
> > > > > > > > > > 
> > > > > > > > > > `standard\_exception\_handling’
> > > > > > > > > > 
> > > > > > > > > > actionpack (2.3.2, 2.0.2, 1.13.6, 1.13.3)  
> > > > > > > > > > gem\_plugin (0.2.3)  
> > > > > > > > > > rake (0.8.4)
> > > > > > 
> > > > > > * * *
> > > > > 
> > > > > [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)
> > 
> > To unsubscribe from this list, please visit:

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```

---

<div class="post-metadata">

**Author:** ![Brendan\_Grainger](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/a698b9/32.png) [@Brendan\_Grainger](https://www.ruby-forum.com/u/Brendan_Grainger)\
**Post date:** [April 16, 2009, 2:43am UTC](https://www.ruby-forum.com/t/lost-connection-to-mysql-server-during-query/165511/11 "2009-04-16T02:43:55Z")

</div>

can you run it with --trace do see if you get any additional info ?

On Wed, Apr 15, 2009 at 5:43 PM, Brendan Grainger  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > development section of database.yml.
> > 
> > > Yes. In fact I can run the application no problem using the same
> > > 
> > > Thanks again
> > > 
> > > > > > connection died.
> > > > > > 
> > > > > > > On Apr 14, 2009, at 12:30 PM, Brendan Grainger wrote:
> > > > > > > 
> > > > > > > > > I’m trying to run an existing rails app on jruby. When I run:  
> > > > > > > > > TABLES  
> > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/connection\_adapters/mysql\_adapter.rb:243:in
> > > > > > > > > 
> > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
> > > > > > > > > 
> > > > > > > > > `invoke\_task’  
> > > > > > > > > /usr/local/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
> > > > > > > > > 
> > > > > > > > > /usr/local/jruby/bin/rake:19  
> > > > > > > > > activerecord-jdbcmysql-adapter (0.9.1)  
> > > > > > > > > jruby-openssl (0.4)  
> > > > > > > > > sources (0.0.1)
> > > 
> > > * * *
> > 
> > [http://xircles.codehaus.org/manage\_email](http://xircles.codehaus.org/manage_email)

* * *

To unsubscribe from this list, please visit:

```
http://xircles.codehaus.org/manage_email

```
