Friday, 27 April 2012

Creating an Adobe CQ web application that uses MySQL

You can create an Adobe CQ web application that performs database operations on a relational database. For example, you can create an Adobe CQ web application that retrieves data from MySQL and displays the data in a JSP. The following illustration shows data being retrieved from a relational database and displayed in a JSP.

To read this entire article, click this link:

If you are interested in learning how to persist Adobe CQ data into MySQL, click here:

Join the Adobe Experience Cloud Community 

Join the Adobe Experience Cloud Community by clicking this banner

I (Scott Macdonald) am a Senior Digital Marketing Community Manager at Adobe Systems with 20 years in the high tech industry. I am also a programmer with knowledge in Java, JavaScript, C#,C++, HTML, XML and ActionScript. If  you would like to see more CQ or other Adobe Digital Marketing end to end articles like this, then leave a comment and let me know what content you would like to see.

TwitterFollow the Digital Marketing Customer Care team on Twitter @AdobeExpCare.

YouTube: Subscribe to the AEM Community Channel


  1. Hello,

    I am trying to connect to a external MySQL database from within a bundle.
    But I keep getting this error:
    Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure Last packet sent to the server was 0 ms ago.)

    These are the details:
    1) Spring bundle(using Spring DM)
    2) MySQL database is at port 7046 so my bean is as below:

    My code connects to the mysql database from local felix installation. But when I put the same bundle within CQ I get the error.

    Please help.

  2. Could you please post one working example of Sling Filter? I have seen the documentation, but it does not help much.

  3. I will add this to the list of Blog items - working with Sling, Filters ,etc. Thanks!

  4. Hi Scott, Not sure if you know but there is a JDBC connection pool factory in CQ5 which allows you to a DataSource service in Felix containing the jdbc driver and connection properties. Then that service can be used by any Osgi service or component jsp to retrieve the jdbc connection and make calls. That would avoid the need for your connectionhelper. Hope this helps.


  5. Thanks for the comment - i am aware of the connection pool. I will be writing another artilce that shows how to connect to the connection pool. The objective of this artilce was to show how to create an OSGi that talks to a database with only Java APIs. Thanks for your comment.

  6. Here is the AEM article that talks about using the DataSourcePool: