forrest-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sedziwoj <sedzi...@epf.pl>
Subject Re: Database Plugin
Date Sun, 05 Feb 2006 22:08:42 GMT
Ross Gardler napisaƂ(a):

> Just change the xconf and xweb configuration (in the conf directory) to 
> use the mySQL driver and your database settings.

This is my config modyfication:
"cocoon-databases.xconf"

<components>
  <include 
src="resource://org/apache/cocoon/components/database/database.roles"/>

   <datasources>
     <jdbc name="telefony">
       <pool-controller min="5" max="10"/> 
<dburl>jdbc:mysql://localhost:3306/telefony?autoReconnect=true</dburl>
       <user>MyUser</user>
       <password>MyPassword</password>
     </jdbc>
   </datasources>
   </components>

"hsql.driver.xweb"

<xweb 
xpath="/web-app/servlet/init-param[param-name='load-class']/param-value"
	unless="text()[contains(string(.),'com.mysql.jdbc.Driver')] |
		comment()[contains(string(.),'com.mysql.jdbc.Driver')]">
         <!-- For Database Driver: -->
         com.mysql.jdbc.Driver

</xweb>

"input.xmap"

<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   <map:components>
	<map:transformers default="xslt">
	  <map:transformer name="sql" 
src="org.apache.cocoon.transformation.SQLTransformer"/>
	</map:transformers>
   </map:components>

   <map:pipelines>
	  <map:pipeline>
	   <map:match pattern="ks_tel.xml">
	    <map:generate src="{project:content.xdocs}/kt/ks_tel.xml"/>
		<map:transform type="sql">
	  	  <map:parameter name="dburl" 
value="jdbc:mysql://localhost:3306/telefony?autoReconnect=true"/>
	      <map:parameter name="username" value="MyUser"/>
		  <map:parameter name="password" value="MyPassword"/>
		  <map:parameter name="show-nr-of-rows" value="true"/>
		</map:transform>
		<map:transform src="resources/stylesheets/sqldata2table.xsl"/>
	    <map:serialize type="xml"/>
	   </map:match>
	  </map:pipeline>
    </map:pipelines>

</map:sitemap>

"web.xml"
...
<init-param>
       <param-name>load-class</param-name>
       <param-value>com.mysql.jdbc.Driver
       </param-value>
     </init-param>
...

My XML file:
"ks_tel.xml"

<document>
	<header>
		<title>Telefony</title>
	</header>
	<body>
		<section>
			<title>Sortuj</title>
   <sql:execute-query xmlns:sql="http://apache.org/cocoon/SQL/2.0">
     <sql:use-connection>telefony</sql:use-connection>
     <sql:query>
       select * from telefony;
     </sql:query>
   </sql:execute-query>
	</section>
	</body>
</document>

Forrest even not trying connect to DB server (I checked this in server 
logs). I don't know what is wrong. Can you help me? I dont know Java 
lang. or Cocoon.

> The plugin is only a slightly modified version of the Cocoon Database 
> block, the documentation for the Cocoon Block is still relevant.

I checked this documentation, description of SQL Transformer, articles 
in Cocoon Wiki about database connection and "A User's Look at the 
Cocoon Architecture By Matthew Langham, Carsten Ziegeler" - description 
of Cocoon-database connection. I still don't know when I do wrong. Can 
you help me?

Thank you
Greg


Mime
View raw message