Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Connection Pool in AEM

Avatar

Level 6

Hi Everyone,

 

I am working to establish/integrate JDBC connection pool in AEM.

 

  1. Installed JDBC driver
  2. Configured the Day Commons JDBC Connections Pool configuration.
  3. Created a simple OSGI service to initialize  DataSource and reading connection from a util.

 

I can get the connection from the connection pool and the code is working fine.

 

My question is,

 

  • Is there any AEM recommended code base available for connection pool configuration/set up or DataSource OSGI service?
  • Currently we are creating connection and closing it in finally block, after changing into Connection Pool also, It is recommended to close the connection in the logic finally block after use right?
  • Few articles mentioned, if we close the connection from logic, it wil not actually close the connection, but connection pool will get notified and it will keep the connection for next use..Is it right

 

Can someone provide some Adobe recommened documentation for the same.

 

1 Accepted Solution

Avatar

Correct answer by
Level 6

We proceeded with Day Commons JDBC Connections Pool.

We have created an interface and implemented OSGI services for the same and getting the connection.

 

In the implementation class, we have created method to get connection based on data source.

Same connection, we have used in other functions and it is working fine.

 

 

View solution in original post

4 Replies

Avatar

Community Advisor

Hi @akhilraj 

I believe you are using the Day Commons JDBC Connections Pool. I would suggest to try the Apache Sling Connection Pooled datasource which is based on http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

 

While I don't have the comparison between the 2 it looks like the apache Sling Connection Pooled datasource should handle your scenario of idle connections better. Here is a reference link on how to configure it - https://helpx.adobe.com/experience-manager/6-3/forms/using/data-integration.html

Hope this article will help you out to fix this issue.

  1. https://stackoverflow.com/questions/41745219/oracle-jdbc-connection-timed-out-issue

 

 



Avatar

Administrator

@akhilraj Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni

Avatar

Correct answer by
Level 6

We proceeded with Day Commons JDBC Connections Pool.

We have created an interface and implemented OSGI services for the same and getting the connection.

 

In the implementation class, we have created method to get connection based on data source.

Same connection, we have used in other functions and it is working fine.

 

 

Avatar

Administrator

Thank you for sharing this solution with the AEM community. Looking forward to seeing you more in this community.

 



Kautuk Sahni