← Back to team overview

dhis2-devs team mailing list archive

Re: Errors in JDBC connection

 

This seems to be a known problem between mysql, java and c3p0 (the database
connection pool).  It seems that mysql resets connections which are not
used for 8 hours (by default).  For some reason these stale connections
then get served up from the connection pool giving rise to this error.

You can kick the problem further down the tracks by increasing the timeout
on the mysql side.  check the documentation for the configuration option.

Or you can make c3p0 more robust, for example by checking connections on
checkout (google 'c3p0 mysql reset' for lots of discussion, tips, advice
etc).  This involves tweaking hibernate settings, possibly inside the war
file.  I haven't tested myself on mysql for a long time.  I think HISP
India folk probably have the best experience of supporting mysql on DHIS2
over the years.

On 25 January 2017 at 07:55, Neeraj Gupta <neeraj.hisp@xxxxxxxxx> wrote:

> Dear team,
>
> For one of our client, we are using DHIS2.21 with MySQL 5.6. Application
> server and database server are separate and can talk to each other.
> Since last 3 weeks, they are facing issues and getting the below message
> instead of login screen.
>
> *org.springframework.transaction.CannotCreateTransactionException: Could
> not open Hibernate Session for transaction; nested exception is
> org.hibernate.TransactionException: JDBC begin transaction failed*
>
> After refreshing the page twice or thrice login page gets loaded.
>
> I tried to check the log file and found below errors
>
>    - org.hibernate.TransactionException: JDBC begin transaction failed
>    - com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
>    Communications link failure
>    - java.net.SocketException: Connection reset
>
> Has anyone had any idea about these and how these can be rectified? Any
> help is much appreciated.
>
> --
> Thanks,
> Neeraj Gupta
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
>
>

Follow ups

References