cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Created: Database FAQs
Date Thu, 22 Sep 2005 14:15:52 GMT
A new document has been created.

Document ID: 722
Branch: main
Language: default
Name: Database FAQs
Document Type: Document
Created: 9/22/05 2:15:50 PM
Creator (owner): Helma van der Linden
State: publish


Mime type: text/xml
Size: 3524 bytes

<h2>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?</h2>

<p>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.</p>

   &lt;!-- comma or whitespace separated list of fully
     qualified class names to load on startup.

<p>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.</p>

<h2>The sql samples don't run.</h2>

<p>The sql samples are working when deploying the war file using the build

<pre>./ \
   -Dinstall.war=path/to/tomcat/webapps install

<p>This command will take care of the path inside the configuration file to the
database resources.</p>

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

<p>This happens when the servlet engine has been stopped abruptly (e.g. with

<p>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/" to the value "yes" while some JDBC connections

<p>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.

<p>To unlock the database, change manually "modified" to "no" in the
"" before restarting the server.</p>

<h2>I get an AbstractMethodError when Cocoon tries to query my database.</h2>

<p>In this case Cocoon returns a "500 internal error" result, and the
AbstractMethodError is visible in the tomcat logs after a call to

<p>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.</p>

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

<pre>        &lt;map:transformer 

<h2>Where can I find more information about connecting to databases using

<p>Learn more about connecting to databases by downloading the free chapter,
<a href="{C3C05052-BE3B-4E06-A60A-13FB40AF58F6}">A
User's Look at the Cocoon architecture,</a> from Langham and Ziegeler's
<em>Cocoon: Building XML Applications</em> available at the New Riders web site.


The document belongs to the following collections: legacydocs

View raw message