Database FAQs
http://xml.apache.org/http://www.apache.org/http://www.w3.org/

Main

FAQs
Index

Getting Started
Install
Configure
CVS

Using
Configure C2
Databases
XSP
XSLT
Debugging

Sitemap
Sitemap
Generators
Transformers
Serializers
Matchers
Selectors
Actions
Aggregators

Questions
Answers
When I try to use the Connection pooling code, I get the following exception: "Could not get the datasource java.sql.SQLException: You cannot get a Poolable before the pool is initialized". What's going on?

The most common reason for this exception is that the driver was not loaded. Cocoon uses an initial parameter in the "web.xml" file to automatically load classes on startup. This way, the class is loaded only once and the server's time is spent doing more productive things. Make sure the following entry is in your "web.xml" file.

<init-param>
 <param-name>load-class</param-name>
 <param-value>
   <!-- comma or whitespace separated list of fully
     qualified class names to load on startup.
   -->
   oracle.jdbc.driver.OracleDriver
 </param-value>
</init-param>

If the class is loaded correctly, and you are still getting this error, then there is probably an error in your connection information. The SQLException above is thrown when there are no open connections to the database.

The sql samples don't run.

The sql samples are working when deploing the war file using the build system:

./build.sh \
   -Dinclude.webapp.libs=yes \
   -Dinstall.war=path/to/tomcat/webapps install

This command will take care of the path inside the configuration file to the database resources.

I've been able to run the database samples, but they don't run anymore.

This happens when the servlet engine has been stopped abruptly (e.g. with ctrl-C).

Hsqldb - the database used by C2 samples - is a single-process engine that locks the database by setting the "modified" entry in "WEB-INF/db/cocoondb.properties" to the value "yes" while some JDBC connections exist.

With connection pooling, there's always some connections opened, and they're not closed properly when you stop abruptly the servlet engine, so the database stays in locked state and connections are refused at the next server startup.

To unlock the database, change manually "modified" to "no" in the "cocoondb.properties" before restarting the server.

I get an AbstractMethodError when Cocoon tries to query my database.

In this case Cocoon returns a "500 internal error" result, and the AbstractMethodError is visible in the tomcat logs after a call to Connection.prepareStatement(...).

This happens when the JDBC driver being used does not implement the JDBC 1.2 interfaces: using its default configuration, the SQLTransformer calls a version of the JDBC Connection.prepareStatement(...) method that is not available in pre-1.2 drivers.

To avoid this problem, configure the SQLTransformer with "old-driver=true" in the sitemap, as shown in this example:

        <map:transformer 
          logger="sitemap.transformer.sql" 
          name="sql" 
          src="org.apache.cocoon.transformation.SQLTransformer"
        >
          <old-driver>true</old-driver>
        </map:transformer> 
        
Where can I find more information about connecting to databases using Cocoon?

Learn more about connecting to databases by downloading the free chapter, A User's Look at the Cocoon architecture, from Langham and Ziegeler's Cocoon: Building XML Applications available at the New Riders web site.

How can I add my FAQ to this document?

Follow the instructions found in How-To Author an FAQ.

How can I suggest improvements to existing FAQs?

Given the rapid pace of change with Cocoon, many individual FAQs quickly become out-of-date and confusing to new users. If you have the relevant knowledge, please consider updating other FAQs on this page for technical errors. If you see a few typos, please consider fixing them too. Follow the instructions found in How-To Author an FAQ.

Copyright © 1999-2002 The Apache Software Foundation. All Rights Reserved.