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 w开发者_如何学Goith postgres. Any hints?
PS: The mysql driver is 5.1 and Grails 1.2 and 1.3
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
}
精彩评论