home *** CD-ROM | disk | FTP | other *** search
Wrap
<?xml version="1.0" encoding="UTF-8"?> <!-- Copyright 1999-2004 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!DOCTYPE faqs PUBLIC "-//APACHE//DTD FAQ V1.0//EN" "faq-v10.dtd"> <faqs title="Database FAQs"> <faq> <question> 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? </question> <answer> <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> <source><![CDATA[ <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> ]]></source> <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> </answer> </faq> <faq> <question> The sql samples don't run. </question> <answer> <p> The sql samples are working when deploing the war file using the build system:</p> <source> ./build.sh \ -Dinstall.war=path/to/tomcat/webapps install </source> <p> This command will take care of the path inside the configuration file to the database resources. </p> </answer> </faq> <faq> <question> I've been able to run the database samples, but they don't run anymore. </question> <answer> <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> </answer> </faq> <faq> <question> I get an AbstractMethodError when Cocoon tries to query my database. </question> <answer> <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> <source><![CDATA[ <map:transformer logger="sitemap.transformer.sql" name="sql" src="org.apache.cocoon.transformation.SQLTransformer" > <old-driver>true</old-driver> </map:transformer> ]]></source> </answer> </faq> <faq> <question> Where can I find more information about connecting to databases using Cocoon? </question> <answer> <p> Learn more about connecting to databases by downloading the free chapter, <link href="http://www.newriders.com/books/product.asp?product_id={C3C05052-BE3B-4E06-A60A-13FB40AF58F6}" >A User's Look at the Cocoon architecture,</link> from Langham and Ziegeler's <em>Cocoon: Building XML Applications</em> available at the New Riders web site. </p> </answer> </faq> </faqs>