Connection to Firebird

This document explains the specific aspects of connecting Cocoon to a Firebird database.

For a general explanation on database connections please refer to the official documentation .

Downloading the jdbc driver

The zip file containing the necessary jar(s) can be downloaded here .

Unzip the file firebirdsql-full.jar which is contained in the zip file you just downloaded either into $COCOON_HOME/web-inf/lib or $TOMCAT_HOME/common/lib/, depending on whether you want it to be accessible only for Cocoon or for all your Tomcat webapps. If for whatever reason you have to use firebirdsql.jar instead, you must add at least mini-concurrent.jar, mini-j2se.jar, and, if your JDK is pre-1.4, jaas.jar. All these files are included in the downloaded zip file as well.

Setting Web.xml

In the $Cocoon_Home/WEB-INF/ directory you will find the web.xml file. Open it and look for these 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 Firebird:   --> 
  	  org.firebirdsql.jdbc.FBDriver 

Setting cocoon.xconf

Search for:
<datasources>
Add into this element these lines:

  <jdbc name="YourPoolName">
    <pool-controller min="5" max="10" />
    <dburl>jdbc:firebirdsql:YourIP/YourPort:/YourPath.gdb</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 like this:

<map:match pattern="YourPattern">
  <map:generate src="YourSourcePath"/>
  <map:transform type="sql">
    <map:parameter name="use-connection" value="YourPoolName"/>
  </map:transform>
  <map:transform type="xslt" src="YourXslStylesheetPath"/>
  <map:serialize type="YourSerializer"/>
</map:match>

Of course you have to adapt this sample to fill your need.

SpecificDatabaseConnection

Comments from the readers:

  • No labels