You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2005/01/06 14:45:12 UTC
[Cocoon Wiki] New: PervasiveSQL
Date: 2005-01-06T05:45:12
Editor: AlexanderZirl
Wiki: Cocoon Wiki
Page: PervasiveSQL
URL: http://wiki.apache.org/cocoon/PervasiveSQL
no comment
New Page:
= Connection to postgreSQL =
This document explains the specific aspect of connecting Cocoon to a Pervasive SQL Database.[[BR]]
For a general explanation on database connection please refer to the [http://xml.apache.org/cocoon/developing/datasources.html official documentation ].
== Downloading the jdbc drivers ==
The jdbc drivers are shipped with the normal Installation Setup. They can be found here: <install-dir>\Bin.[[BR]]
Drop the pvjdbc2.jar file either in $COCOON_HOME/web-inf/lib or $TOMCAT_HOME/common/lib/. I did not need to bother about the pvjdbc2x.jar
== Setting Web.xml ==
In the $Cocoon_Home/WEB-INF/ directory you will find the web.xml file. Open it and look for this rows {{{
<init-param>
<param-name>load-class</param-name>
<param-value>
<!--
For IBM WebSphere:
com.ibm.servlet.classloader.Handler ..-->}}}
here you have to add the following line:
{{{
<!-- For Pervasive SQL: -->
com.pervasive.jdbc.v2.Driver
}}}
== Setting cocoon.xconf ==
search for:
{{{<datasources>}}}
add into this element these lines:
{{{
<jdbc name="YourPoolName">
<pool-controller min="5" max="10"/>
<dburl>jdbc:pervasive://loc:5432/DB_Name</dburl>
<user>YourUsername</user>
<password>YourPassword</password>
</jdbc>
}}}
== Setting sitemap.xmap ==
When you want to use the connection you just call the jdbc name inside the pipeline in this way:
{{{
<map:match pattern="sqlquery">
<map:generate src="sql/sqlquery.xml"/>
<map:transform type="sql">
<map:parameter name="use-connection" value="YourPoolName"/>
<map:parameter name="show-nr-of-rows" value="true" />
<map:parameter name="clob-encoding" value="UTF-8" />
</map:transform>
<map:serialize />
</map:match>
}}}
Obviously you have to adapt this sample to fill your need.[[BR]]
SpecificDatabaseConnection
== Comments ==
* Thanks for the Template (adopted from the author of "PostgreSQL")
== Bugs?! ==
* I'm getting an XML error when serializing to XML. The result-row-element has twice the same attribute. I'm not sure whether this is due to the driver, but I assume it's due to some other mistake. HTML et al. works fine.