Reset/Flush JDBC connections pool | Community
Skip to main content
February 2, 2016

Reset/Flush JDBC connections pool

  • February 2, 2016
  • 3 replies
  • 6581 views

Hi, is there a way to reset/flush the JDBC connections pool programmatically?  I've configured a connection to a MySQL database via the Apache Felix Web Console and it seems like I can accomplish this by clicking on the "Reset" button in the JDBC Connections Pool dialog.  However, is there a way to do this using the DataSourcePool object (which I have access to in an AEM component via sling.getService(DataSourcePool.class).

The reason why I want to do this is because the connection appears to be getting dropped intermittently with the following error message:

SQL state is 08S01, message is Communication link failure: java.net.SocketException, underlying cause: Connection reset

I've tried playing around with the pool size but it hasn't resolved the issue.  Any help would be much appreciated.  Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

smacdonald2008
February 2, 2016

The DataSourcePool object does not expose a method to let you perform this task. This is the DataSourcePool class def: 

package com.day.commons.datasource.poolservice;

import java.util.Collection;

public abstract interface DataSourcePool
{
  public abstract <AdapterType> AdapterType getDataSource(String paramString, Class<AdapterType> paramClass)
    throws DataSourceNotFoundException, TypeNotAvailableException;
  
  public abstract Object getDataSource(String paramString)
    throws DataSourceNotFoundException;
  
  public abstract Collection<String> getAllJndiDataSourceNames();
}

I will look to see if there are other ways.

dmuthukrAuthor
February 3, 2016

Thanks.  Yes, I noticed that it doesn't allow me to do it.  I wonder if this should happen on the DataSource level or perhaps the Connection level.  I'm not sure.

smacdonald2008
February 3, 2016

I will check tomorrow if there is a mean operation to perform this task.

joerghoh
Adobe Employee
Adobe Employee
February 3, 2016

Shouldn't a datasource be resilient against this kind of error and recreate connections to the database if required?

Jörg

dmuthukrAuthor
February 3, 2016

Jörg Hoh wrote...

Shouldn't a datasource be resilient against this kind of error and recreate connections to the database if required?

Jörg

 

Is there a way to configure this resiliency, either programmatically, or via the web console?

October 13, 2017

I know this is an old post but just curious if you ever found a solution to this?  We are also running into an issue after updating the username or password and get the following error

[EL Finest]: 2017-10-13 15:54:56.967--reconnecting to external connection pool

[EL Warning]: 2017-10-13 15:54:56.968--java.lang.IllegalStateException: Pool not open.

Stopping and staring the bundle that uses the jdbc pool connection fixes the issue but what we really want is for it to pickup the new user/password on the next connection attempt automatically.

smacdonald2008
October 13, 2017

I have never seen a fix for this after all of this time. I personally restart the bundle when i change this. Ironically - just finished working with a DataSourcePool for a new HTL/Sling Model article -- Scott's Digital Community: Creating a Mail List Component for the Experience Manager Toy Store Site