SQL exception after a few hours

32 views
Skip to first unread message

Simon Kelly

unread,
May 14, 2013, 11:23:53 PM5/14/13
to circumfl...@googlegroups.com
Hi.

I have a web application using the LiftWeb framework and Circumflex ORM. Everything is working fine for a few hours and then I start getting the following exception
"com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operations allowed after statement closed"

I believe the issue may be down to the database connection becoming stale after the long time of inaction but I cannot find a way to make circumflex re-connect automatically if the database connection has closed after a period of inactivity.

Is there a configuration setting I can use to force circumflex to reconnect automatically if this occurs?

Kind regards

Simon

Boris Okunskiy

unread,
May 16, 2013, 1:21:12 AM5/16/13
to circumfl...@googlegroups.com
Hi,


We suggest that you wrap your transactions in `Context.executeInNew { ctx => ... }` blocks as we've mentioned a lot when discussing integration ORM with different web frameworks. The most obvious choice would be request filter, which wraps an entire request processing logic into a context-aware block — this way each transaction will be committed when the response is about to be sent.

Best regards,
Boris Okunskiy
Chief Software Architect
EduArea LLC / SAVANT.PRO
http://savant.pro

-- Soit le meilleur dans ce que tu feras.

--
You received this message because you are subscribed to the Google Groups "Circumflex Public Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email to circumflex-sca...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Simon Kelly

unread,
May 19, 2013, 9:13:27 PM5/19/13
to circumfl...@googlegroups.com
Thanks Boris, that was very helpful.

I've wrapped each call to the db with the executeInNew{} and this has worked.

Cheers

Simon
Reply all
Reply to author
Forward
0 new messages