Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

create OSGI configuration dynamically

adobecq-venkat
Level 3
Level 3

HI,

I need to create a JDBC configuration dynamically like build time. 

This can be using either OSGI config API  or properties etc..

Any help would be appreciated.

 

 

# Configuration created by Apache Sling JCR Installer
jdbc.password="XYZZZ"
jdbc.driver.class="com.microsoft.sqlserver.jdbc.SQLServerDriver"
datasource.name="testjdbc"
jdbc.connection.uri=""
jdbc.validation.query=""
datasource.svc.properties=[""]
default.readonly=B"false"
default.autocommit=B"true"
jdbc.username="app_optout"
pool.size=L"50"
pool.max.wait.msec=L"20000"

1 Accepted Solution
Manjunath_K
Correct answer by
Community Advisor
Community Advisor

Hi @adobecq-venkat ,

You can add this JDBC config xml in runmodes with the property values as you mentioned above & these runmode configs will be deployed part of build.

View solution in original post

6 Replies
Manjunath_K
Correct answer by
Community Advisor
Community Advisor

Hi @adobecq-venkat ,

You can add this JDBC config xml in runmodes with the property values as you mentioned above & these runmode configs will be deployed part of build.

View solution in original post

adobecq-venkat
Level 3
Level 3
Thanks for the answer. Can you give an sample file & where it is located in crx de?
Manjunath_K
Community Advisor
Community Advisor

@adobecq-venkat 

You need put these config xml files under project runmodes folder structure. if these config property values varies from environment to environment in your project then create environment specific config folder as mentioned below.

 

/apps/project/runmodes/config
/apps/project/runmodes/config.stage.publish
/apps/project/runmodes/config.prod.publish


Sample xml file:
com.day.commons.datasource.jdbcpool.JdbcPoolService-uniqueName.xml

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
jdbc.username=""
jdbc.password=""
jdbc.driver.class=""
datasource.name=""
jdbc.connection.uri=""
pool.size=""
pool.max.wait.msec=""/>

 

Hope this helps!

adobecq-venkat
Level 3
Level 3
This looks like AEM 6.5. Currently I am using 6.1. Cant find these directories
Manjunath_K
Community Advisor
Community Advisor

@adobecq-venkat  this is not based on AEM version, if this runmodes folder not present in your project structure then create these folders & put config xml files under config/environment specific config folder.

 

refer this in crx/de

/apps/weretail/config

/apps/weretail/config.publish