cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <>
Subject Re: Closing Cayennes' DataContext
Date Thu, 15 Jan 2015 07:30:54 GMT
>  Is there a way to close cayennes' DataContext.?

While the rest of the thread correctly focused on the size of the connection pool, I wanted
to clarify this point. There's no need to "close" a DataContext in Cayenne. The DataContext
by itself does not hold any open connections. 


> On Jan 2, 2015, at 6:43 PM, jonathan_ms2006 <> wrote:
> Hi Andrus, 
>      Good day! Is there a way to close cayennes' DataContext.? In my web
> application I'm using this code "DataContext context =
> ServletUtil.getSessionContext(session);" as suggested on cayenne website.
> However the problem is, it is creating new connection every time a page
> loads which as a result, returns an error when there are multiple users
> accessing the web application:
> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data
> source rejected establishment of connection,  message from server: "Too many
> connections". 
> Any ideas how to overcome this error in cayenne.? Thank you in advance. 
> Best Regards, 
> Jonathan

View raw message