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 Vs JCR Nodes

Avatar

Level 2

We have all the user information stored in database and based on login id we need to fetch the data & show the Pie Chart on JSP.

Do I need to call DB to fetch the data or would it be fine if I can create user nodes of type "nt:unstructured" in the JCR itself.

Ex:- https://helpx.adobe.com/experience-manager/using/displaying-experience-manager-data-chart.html 

What could be the best approach here.

Note:-  The data is updated only once in six months in the database

Any suggestions please ?

Thanks in advance

1 Accepted Solution

Avatar

Correct answer by
Administrator

Hi

As mentioned by Scott,

We can do it definitely by calling DB as well as creating corresponding JCR nodes in JCR.

We can achieve it in 3 ways:-

1. Create a component/Service that exports the JDBC driver package.

      //Fetch data from DB and store in JCR.

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Bundling the JDBC Database Driver

    Helpx (Help to create "Querying and Persisting Adobe AEM data into MySQL" ):- https://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html [Fetch DATA]

    Helpx: - https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html [Accessing/Storing Content in JCR, using JCR API]

 

2. Obtain a data source object and create the connection in your code

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Connecting to the Database 

    Helpx :- https://helpx.adobe.com/experience-manager/using/datasourcepool.html

                Once you retrieve the data from the database (using a injected DataSourcePool), you can encode the data into JSON.

3. Configuring the JDBC Connection Pool Service

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Configuring the JDBC Connection Pool Service

 

Once you have the data, you can use any JQuery Plugins to populate the data on pie charts 

Link:- http://www.jqueryscript.net/tags.php?/pie%20chart/      http://designmodo.com/jquery-charts-graphs/     https://www.sitepoint.com/11-best-jquery-charting-libraries/

 

I hope this would be useful.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

View solution in original post

3 Replies

Avatar

Level 10

There is no reason why you cannot leave the data in the database and retrieve it using an AEM Service that uses a DataSourcePool: 

https://helpx.adobe.com/experience-manager/using/datasourcepool.html

Once you retrieve the data from the database (using a injected DataSourcePool), you can encode the data into JSON or XML and use that data to populate a JQuery PieChart plug-in. 

So it does not matter if the data is retrieved from a Relational Database or the JCR - either way - you have to retrieve it and encode the data to populate a JQuery plug-in. 

Hope this helps

Avatar

Correct answer by
Administrator

Hi

As mentioned by Scott,

We can do it definitely by calling DB as well as creating corresponding JCR nodes in JCR.

We can achieve it in 3 ways:-

1. Create a component/Service that exports the JDBC driver package.

      //Fetch data from DB and store in JCR.

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Bundling the JDBC Database Driver

    Helpx (Help to create "Querying and Persisting Adobe AEM data into MySQL" ):- https://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html [Fetch DATA]

    Helpx: - https://helpx.adobe.com/experience-manager/using/programmatically-accessing-cq-content-using.html [Accessing/Storing Content in JCR, using JCR API]

 

2. Obtain a data source object and create the connection in your code

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Connecting to the Database 

    Helpx :- https://helpx.adobe.com/experience-manager/using/datasourcepool.html

                Once you retrieve the data from the database (using a injected DataSourcePool), you can encode the data into JSON.

3. Configuring the JDBC Connection Pool Service

    Doc:- https://docs.adobe.com/docs/en/aem/6-2/develop/platform/jdbc.html#Configuring the JDBC Connection Pool Service

 

Once you have the data, you can use any JQuery Plugins to populate the data on pie charts 

Link:- http://www.jqueryscript.net/tags.php?/pie%20chart/      http://designmodo.com/jquery-charts-graphs/     https://www.sitepoint.com/11-best-jquery-charting-libraries/

 

I hope this would be useful.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Level 2

Thanks a lot for the suggestions,

I was going through other Links in the forum for the difference between JCR & Database and found this link

http://dev.day.com/content/ddc/blog/2009/01/jcrrdbmsreport/_jcr_content/images/jcrrdbmsreport/jcr_rd...

But it seems this link to be broken

I found this on the http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage... 

Could you please provide me the correct link

Thanks again :)