Connection Problem with CQ5 with MySql
Hi,
I am trying to connect CQ5 with MySql.
I followed the below link to Injecting a DataSourcePool into Adobe Experience Manager Sling Servlets
http://helpx.adobe.com/experience-manager/using/custom-sling-servlets1.html
I have specified the below details in /system/console/configMgr ----> JDBC Connection pool Settings
Username = root ,
Password = root123 ,
JDBC Driver Class= com.mysql.jdbc.Driver,
JDBC connection URI = jdbc:mysql://localhost:3306/test ,
DatasourceName = Customer.
On Server side (SlingServlet Method Post), am trying to connect the MySql Datasource.
private Connection getConnection()
{
DataSource dataSource = null;
Connection con = null;
try
{
dataSource = (DataSource) source.getDataSource("Customer");
con = dataSource.getConnection();
return con;
}
catch (Exception e)
{
e.printStackTrace();
}
return null;
}
On invoking the above mentioned function, am getting exception at runtime
Connection c = getConnection();
Exception
com.day.commons.datasource.poolservice.DataSourceNotFoundException: No data source found with name 'Customer' (after asking 0 providers)
at com.day.commons.datasource.poolservice.impl.DataSourcePoolImpl.getDataSource(DataSourcePoolImpl.java:109)
at com.adobe.cq.sling.ds.HandleClaim.getConnection(HandleClaim.java:134)
at com.adobe.cq.sling.ds.HandleClaim.injestCustData(HandleClaim.java:155)
at com.adobe.cq.sling.ds.HandleClaim.doPost(HandleClaim.java:97)
at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.java:148)