cocoon-docs mailing list archives

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

http://cocoon.zones.apache.org/daisy/legacydocs/722.html

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

Parts
=====

Content
-------
Mime type: text/xml
Size: 3524 bytes
Content:
<html>
<body>

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

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

<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
system:</p>

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

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

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

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

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

<p>To unlock the database, change manually "modified" to "no" in the
"cocoondb.properties" 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
Connection.prepareStatement(...).</p>

<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 
          logger="sitemap.transformer.sql" 
          name="sql" 
          src="org.apache.cocoon.transformation.SQLTransformer"
        &gt;
          &lt;old-driver&gt;true&lt;/old-driver&gt;
        &lt;/map:transformer&gt; 
        </pre>

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

<p>Learn more about connecting to databases by downloading the free chapter,
<a href="http://www.newriders.com/books/product.asp?product_id={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.
</p>

</body>
</html>

Collections
===========
The document belongs to the following collections: legacydocs

Mime
View raw message