xain
xain

Reputation: 13839

Grails / Mysql problem with first query

I'm migrating my application from postgres to mysql and I've noticed the "first" query (I assume after some timeout) always fails. I've seen it with both selects and inserts. Certainly it didn't happen with postgres. Any hints?

PS: The mysql driver is 5.1 and Grails 1.2 and 1.3

Upvotes: 0

Views: 285

Answers (1)

atodd
atodd

Reputation: 366

I'm assuming that you mean the broken pipe error ?

The issue is that mysql has timed out the connection that the application was using. You can modify this property somehwere within mysql, I don't know where that is however. You can also apply a fix easily in your application configuration just add the following to the dataSource block of your DataSource.groovy:

  properties {
     validationQuery="select 1"
     testWhileIdle=true
     timeBetweenEvictionRunsMillis=60000
  }

Upvotes: 1

Related Questions