Connection Pool in AEM | Community
Skip to main content
akhilraj
Level 5
January 31, 2024
Solved

Connection Pool in AEM

  • January 31, 2024
  • 2 replies
  • 2185 views

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.

 

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

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.

 

 

2 replies

Raja_Reddy
Community Advisor
Community Advisor
January 31, 2024

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

 

 

kautuk_sahni
Community Manager
Community Manager
February 2, 2024

@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
akhilraj
akhilrajAuthorAccepted solution
Level 5
February 5, 2024

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.

 

 

kautuk_sahni
Community Manager
Community Manager
February 5, 2024

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

 

Kautuk Sahni