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

How can I connect to a relational database from AEM

Avatar

Level 2

I want to know how to connect to MySQL from AEM. Whats the best way. 

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can use dependency injection and inject a DataSourcePool into an AEM Service. Once you successfully inject a DataSourcePool into an AEM service, you can use SQL commands to interact with MySQL. For information on how to work with DataSourcePools in AEM, see this community article: 

Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi bundle

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

You can use dependency injection and inject a DataSourcePool into an AEM Service. Once you successfully inject a DataSourcePool into an AEM service, you can use SQL commands to interact with MySQL. For information on how to work with DataSourcePools in AEM, see this community article: 

Injecting a DataSourcePool Service into an Adobe Experience Manager OSGi bundle