External database with Adobe CQ5?

Can I connect an external database, such as mysql , to Adobe CQ5 ?

JCR (Java content repository) in Adobe cq5 now connects to the H2 database by default ... how to get it to use sql / mysql?

+4
source share
1 answer

Go to the section: / system / console / configMgr
Open: JDBC Connections Pool Configuration

Enter all the standard JDBC configuration items (username, password, driver, JDBC URI)
Enter the name of the data source (hereinafter referred to as your file name)

In your JSP or 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) { } } 
+5
source

All Articles