MySql Database not connected (unable to data retriew error showing)i followed Adobe cq Document | Community
Skip to main content
Level 2
October 16, 2015
Solved

MySql Database not connected (unable to data retriew error showing)i followed Adobe cq Document

  • October 16, 2015
  • 14 replies
  • 3704 views

Hi,

I followed in adobe cq5 document exactly store the data in my MySQL but i got problem in application when i am submitting user details it throw unable to retrieve  data i import every thing jquery files and js files can help me am new to cq5 below document i follow.

http://helpx.adobe.com/experience-manager/using/querying-persisting-cq-data-mysql.html

 

Thanks

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

This JSP code:

var url = location.pathname.replace(".html", "/_jcr_content.query.json") + "?filter="+ filter;

sends  a request to this JS file:

<%@include file="/libs/foundation/global.jsp"%>
<%@ page import="org.apache.sling.commons.json.io.*,org.w3c.dom.*" %><%
String filter = request.getParameter("filter");
    
com.adobe.aem.sql.CustomerServiceImp cs = new com.adobe.aem.sql.CustomerServiceImp();
 
String XML = cs.getCustomerData(filter); 
    
//Send the data back to the client
JSONWriter writer = new JSONWriter(response.getWriter());
writer.object();
writer.key("xml");
writer.value(XML);
    
writer.endObject();
%>

This JS file creates an object of type com.adobe.aem.sql.CustomerServiceImp. This Java class is bundled in the OSGi that you created. 

There are three places where something may be wrong:

1. You did not setup the connection class properly.

2. The drvier file is not bundled. 

3. The main page JSP is not finding the query.js file.

Please post your log file - we can tell what is happening from that. 

 

14 replies

Level 2
October 16, 2015

Hi ,

i followed what you say exactly.

i build in crxde component and template and jsp's same project struture  in Adobe  document.

but application not working.

 

thanks

smacdonald2008
Level 10
October 16, 2015

Can you please post your CQ log file. There is a reason why the data is not being returned that leads to the JSON data. 

smacdonald2008
Level 10
October 16, 2015

ZIP up your package and send to me at scottm@adobe.com. I want to look at your code then I will find out where the issue is. 

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

This JSP code:

var url = location.pathname.replace(".html", "/_jcr_content.query.json") + "?filter="+ filter;

sends  a request to this JS file:

<%@include file="/libs/foundation/global.jsp"%>
<%@ page import="org.apache.sling.commons.json.io.*,org.w3c.dom.*" %><%
String filter = request.getParameter("filter");
    
com.adobe.aem.sql.CustomerServiceImp cs = new com.adobe.aem.sql.CustomerServiceImp();
 
String XML = cs.getCustomerData(filter); 
    
//Send the data back to the client
JSONWriter writer = new JSONWriter(response.getWriter());
writer.object();
writer.key("xml");
writer.value(XML);
    
writer.endObject();
%>

This JS file creates an object of type com.adobe.aem.sql.CustomerServiceImp. This Java class is bundled in the OSGi that you created. 

There are three places where something may be wrong:

1. You did not setup the connection class properly.

2. The drvier file is not bundled. 

3. The main page JSP is not finding the query.js file.

Please post your log file - we can tell what is happening from that.