Broken Pipe Exception on Grails App

别等时光非礼了梦想. 提交于 2019-12-02 04:22:28
Dipak Thoke

You need to c3p0 your project

step :1

Add this "BuildConfig.groovy"

dependencies {
        // specify dependencies here under either 'build', 'compile'

        compile 'c3p0:c3p0:0.9.1.2'
    }

step 2:

Datasource groovy: Now your data source will be like this only remove the other things.

beans {
    dataSource(BasicDataSource) {
        **url = "jdbc:mysql://127.0.0.1/db_name"**
        driverClassName = "com.mysql.jdbc.Driver"
        username = "root"
        password = "root"
        pooled = true
   }
}

For more info

Do I need to use C3P0 pooling library in my (grails) web application?

How do I configure c3p0 for a grails 2.X application with multiple datasources?.

http://blog.nutpan.com/2013/07/grails-broken-pipe-and-cannot-release.html

Thanks

With the solutions that were presented here my application was always getting a broken pipe exception. I created a webservice with a script the runs every hour, that way the application never loses its connection to the database. Since then the exception was never been thrown again. Thank you all for your answers anyway :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!