Skip to main content
Level 2
May 28, 2016 6:37 AM UTC
Solved

Database Vs JCR Nodes

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
May 30, 2016 9:04 AM UTC

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

3 replies

smacdonald2008
Level 10
May 28, 2016 4:37 PM UTC

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

Translate
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
May 30, 2016 9:04 AM UTC

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

Translate
Kautuk Sahni
mvk007Author
Level 2
May 31, 2016 1:38 PM UTC

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_rdbms_report_chapuis.pdf

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-manager.topic.html/forum__gifm-i_am_makingacompon.html 

Could you please provide me the correct link

Thanks again :)

Translate