You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jann Forrer <ja...@id.uzh.ch> on 2009/06/02 09:59:22 UTC

Re: Lenya and database

Hi Arne
>
> Thanks, yes we have activated the SQL Transformer in our sitemap.
>
> In the <map:pipelines> section we added:
>
>      <map:transform type="sql">
>         <map:parameter name="use-connection" value="MyPoolName"/>
>         <map:parameter name="show-nr-of-rows" value="true"/>
>         <map:parameter name="clob-encoding" value="UTF-8"/>
>         <map:parameter name="namespace-uri"
> value="http://apache.org/cocoon/SQL/2.0"/>
>       </map:transform>
>
Not sure where the problem is. For testing purpose i added the following
entries to the sitemap:

1. Add the SqlTransformer to the list of transformers:
  <map:transformer name="sql" logger="sitemap.transformer.sql"
src="org.apache.cocoon.transformation.SQLTransformer"/>

2. <map:match pattern="sqlquery">
  <map:generate type="file" src="lenya/content/databases/mysqltest.xml"/>
  <map:transform type="sql" label="raw">
    <map:parameter name="use-connection" value="mysqlPool"/>
  </map:transform>
  <map:transform src="lenya/xslt/databases/sql2html.xsl"/>
  <map:serialize type="html"/>
</map:match>

3. The important entry in mysqltest.xml looks as follows:
   <page xmlns:sql="http://apache.org/cocoon/SQL/2.0">

  <title>Db Connection Test</title>
  <content>
    <sql:execute-query xmlns="http://apache.org/cocoon/SQL/2.0">
       <sql:query>SELECT * FROM software order by kat;</sql:query>
    </sql:execute-query>
  </content>
</page>

That's it basically. Of course you have to define the mysql connection
parameters (for the mysqlPool) in e.g. cocoon.xconf.

HTH

Jann
 
> --Arne
>
> Jann Forrer wrote:
>> Hi Arne
>>> I am getting an error when trying to run a query.
>>>
>>> error: unknown element "execute-query" from namespace
>>> "http://apache.org/cocoon/SQL/2.0"
>>>
>>> I've following the example for here:
>>> http://cocoon.apache.org/2.1/userdocs/sql-transformer.html
>>>
>>> Do I have the wrong namespace?
>>>
>>> We are running Lenya 2.0.1 and connecting to MySQL 5.0.51a
>>>
>> Did you activate the SQL Transformer in your sitemap?
>>
>> <map:transformer name="sql" logger="sitemap.transformer.sql"
>> src="org.apache.cocoon.transformation.SQLTransformer">
>>
>> We use the SQL Transfomrer in lenya 1.2 and it works fine.
>>
>> Jann
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>> !DSPAM:7,4a1f834e38661859910370!
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>


-- 
Jann Forrer
Informatikdienste
Universität Zürich
Winterthurerstr. 190
CH-8057 Zürich

oooO   mail:  jann.forrer@id.uzh.ch
(  )   phone: +41 1 63 56772
 \ (   fax:   +41 1 63 54505
  \_)  http://www.id.uzh.ch



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org