Before you can see the sample in action make sure you have:
cocoon-databases-sample/src/main/resources/META-INF/cocoon/properties/cocoon-databases.properties
cocoon-databases-sample/src/main/resources/META-INF/cocoon/properties/cocoon-databases.properties
Simple example using the SQL transformer to connect to the c3 database.
cocoon-databases-sample/src/main/resources/META-INF/cocoon/spring/cocoon-databases-context.xmlwe define the database resources. You can add as many as you want. You then call them as always in the sitemap with
<map:transform type="sql"> <map:parameter name="use-connection" value="dataSource" /> </map:transform>where dataSource is our predefiened connection.
Same as above to connect to the c3 database but configured in the sitemap.
<map:transform type="sql"> <map:parameter name="dburl" value="{global:jdbc.url}" /> <map:parameter name="username" value="{global:jdbc.username}"/> <map:parameter name="password" value="{global:jdbc.password}"/> </map:transform>