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

Database Connection in AEM

Avatar

Level 1

Hello, 

           I want to know any  database connection with AEM. i am new to AEM if any one have solution .please let me know. Thanks in advance.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
6 Replies

Avatar

Community Advisor

Hi @prachishingade ,

Adobe Experience Manager (AEM) primarily uses Apache Jackrabbit Oak as its underlying repository, and it's designed to work with a variety of data stores, including both file-based and RDBMS-based repositories. By default, AEM uses a file-based repository for persistence (CRXde). However, for larger deployments or specific use cases, you might consider using an RDBMS (Relational Database Management System) as the persistence layer for AEM.

Here are the general steps to configure AEM to use an RDBMS:

  1. Choose a Database: Select an RDBMS that is supported by Adobe Experience Manager. Common choices include Apache Derby, Oracle, Microsoft SQL Server, and PostgreSQL.

  2. Configure the DataSource: Configure a DataSource in your application server that AEM will use to connect to the RDBMS. This is typically done in the application server's configuration. You may need to provide connection details such as the database URL, username, and password.

  3. Install Database Drivers: Ensure that the necessary JDBC driver for your chosen database is available in the AEM environment. The JDBC driver is needed to establish a connection between AEM and the database.

  4. Configure AEM for RDBMS: Modify the AEM configuration to use the configured DataSource. This involves updating the repository configuration to point to the DataSource, usually through the Apache Jackrabbit Oak configuration.

  5. Recreate the Repository: Depending on your scenario, you might need to recreate the AEM repository to apply the new configuration. Be cautious with this step, especially in a production environment, as recreating the repository will result in data loss.

  6. Testing: After configuring AEM for the RDBMS, thoroughly test the setup to ensure proper functionality and performance. Pay attention to potential issues during the transition.

It's important to note that using an RDBMS introduces additional complexity and considerations. The decision to switch to an RDBMS should be made based on specific requirements and considerations, such as scalability, performance, and maintenance.

Avatar

Level 1

Hi @Madhur-Madan 

Thanks for reply.

         can please provide link how to Configure the DataSource and  Configure AEM for RDBMS .

Avatar

Community Advisor

Hi @prachishingade , please check as I have tried to summarize from the references : 

1. Configure the DataSource: (reference :  https://experienceleague.adobe.com/docs/experience-manager-learn/forms/sign-multiple-documents/confi...)
- Go to AEM web console at `https://server:host/system/console/configMgr`.
- Look for Apache Sling Connection Pooled DataSource configuration.
- Select to open the configuration in edit mode.
- In the configuration dialog, specify the details for the database you want to configure, such as:
- Name of the data source
- Data source service property that stores the data source name
- Java class name for the JDBC driver
- JDBC connection URI
- Username and password to establish connection with the JDBC driver.
https://experienceleague.adobe.com/docs/experience-manager-65/content/forms/form-data-model/configur...

2. Configure AEM for RDBMS: (reference : https://experienceleague.adobe.com/docs/experience-manager-65/content/implementing/deploying/deployi...)
- Make sure the database daemon is started and that you have an active database for use with AEM.
- Copy the AEM 6.3 jar into the installation directory.
- Create a folder called `crx-quickstart\\install` in the installation directory.
- Configure the document node store by creating a configuration file with the following name in the `crx-quickstart\\install` directory: `org.apache.jackrabbit.oak.plugins.document.DocumentNodeStoreService.config`.
- Configure the data source and the JDBC parameters by creating another configuration file with the following name in the `crx-quickstart\\install` folder: `org.apache.sling.datasource.DataSourceFactory-oak.config`.
- In the `crx-quickstart/install` folder, create a folder named `9`. Place the JDBC jar in the new folder.
- Finally, start AEM with the `crx3` and `crx3rdb` runmodes: `java -jar quickstart.jar -r crx3,crx3rdb`.

Avatar

Correct answer by
Community Advisor

Avatar

Community Advisor

Hi @prachishingade 

 

There are 2 common ways to create a data source (separate OSGI Configs that you can access from the system console (http://localhost:4502/system/console/configMgr) -

  • Day Commons Connection pool 
  • Apache Sling Connection Pooled data source 

The Apache Sling Connection Pooled data source is the recommended one because how it handles the idle connections.

 

Here is the documentation for connecting AEM to a database - https://experienceleague.adobe.com/docs/experience-manager-learn/forms/sign-multiple-documents/confi...

 

If you are on AEM as a Cloud Service, there would be some additional networking configurations involved as well which are documented here - https://experienceleague.adobe.com/docs/experience-manager-learn/cloud-service/networking/advanced-n...

 

As you can see there are multiple steps involved so you can try these and reach out to the community for any questions.

 

Thanks

Narendra

 

 

Avatar

Administrator

@prachishingade 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