使用Adobe CQ5的外部数据库?

Nar*_*ddy 4 mysql database adobe external aem

有没有办法连接外部数据库,如mysql可以连接到Adobe CQ5

现在,Adobe cq5中的JCR(Java Content Repository)默认连接到H2数据库...如何使用sql/mysql?

yet*_*ner 5

转至:/ system/console/configMgr
打开:JDBC连接池配置
输入所有标准JDBC配置元素(用户名,密码,驱动程序,JDBC URI)
输入数据源名称(以下称为yourDataSourceName)

在您的JSP或Servlet中:

<%@ page import="com.day.commons.datasource.poolservice.DataSourcePool" %>
<%@ page import="javax.sql.DataSource" %>

DataSourcePool dbService = sling.getService(DataSourcePool.class);
DataSource ds = (DataSource) dbService.getDataSource("yourDataSourceName");

if(ds != null) {
   try {
      %><sql:query var="result" sql="SELECT now()" dataSource="<%=ds%>" /><%
   } catch (Exception e) { } 
}
Run Code Online (Sandbox Code Playgroud)