cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathias Wiegard <Mathias.Wieg...@student.uni-ulm.de>
Subject Re: newby with cocoon esql mysql linux
Date Tue, 17 Jun 2003 19:59:24 GMT
Try this way:
First, make the following entry under

<init-param>
<param-name>load-class</param-name>
      <param-value>
        ...

        <!-- For MySQL Database -->
        com.mysql.jdbc.Driver
       </param-value>
</init-param>

in WEB-INF/web.xml .
This will load the driver at start into the environment. I don'T know your
proceeding of defining an conneciton in an xsp page...
I use connection-pools:
Under the element <datasources> in WEB-INF/cocoon.xconf you can write for
you need:

<jdbc name="name-for-the-connection" logger="core.datasources.
name-for-the-connection">
            <pool-controller max="10" min="5"/>
<dburl>jdbc:mysql://localhost:3306/ma_table_tbl?autoReconnect=true</dburl>
    <user>user</user>
    <password>password</password>
</jdbc>

Now, an example for the xsp could look like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsp:page language="java" xmlns:esql="http://apache.org/cocoon/SQL/v2"
xmlns:xsp="http://apache.org/xsp">
    <page>
        <title>Test</title>
        <content>
            <esql:connection>
                <esql:pool>name-for-the-connection</esql:pool>
                <esql:execute-query>
                    <esql:query>select * from table</esql:query>
                    <esql:results>
                        <entries>
                            <esql:row-results>
                                <esql:get-xml column="type" root="entry"/>
                            </esql:row-results>
                        </entries>
                    </esql:results>
                </esql:execute-query>
            </esql:connection>
        </content>
    </page>
</xsp:page>

By the way: had problems with the mysql driver version 3.x under JDK 1.3.x.
The problems vanished after I updated to JDK 1.4.1 that could be another
reason for your problem...

Hope it helps!
Mat


> Von: ntic <ntic@lespetitsdebrouillards.org>
> Antworten an: cocoon-users@xml.apache.org
> Datum: Tue, 17 Jun 2003 21:00:40 +0200
> An: cocoon-users@xml.apache.org
> Betreff: newby with cocoon esql mysql linux
> 
> Hello,
> I've got some trouble with my cocoon configuration.
> I've got :
> mysql ver. 3.23.54
> the driver is mysql-connector-java-3.0.8-stable-bin.jar in
> webapps/cocoon/WEB-INF/lib/
> cocoon 2.0.4
> 
> my sitemap.xmap file contain :
> 
> *<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
>   <map:components>
>       <map:generators>
>           <map:generator name="serverpages"
> src="org.apache.cocoon.generation.ServerPagesGenerator"/>
>       </map:generators>
>       <map:serializers>
>           <map:serializer name="xml" mime-type="text/xml"
> src="org.apache.cocoon.serialization.XMLSerializer"/>
>       </map:serializers>
>       <map:matchers default="wildcard">
>           <map:matcher name="wildcard"
> src="org.apache.cocoon.matching.WildcardURIMatcher"/>
>       </map:matchers>
>   </map:components>
>   <map:pipelines>
>       <map:pipeline>
>           <map:match pattern="*.xsp">
>               <map:generate type="serverpages" src="{1}.xsp"/>
>               <map:serialize type="xml"/>
>           </map:match>
>       </map:pipeline>
>   </map:pipelines>
> </map:sitemap>
> *
> the web.xml contain :
> *    <init-param>
>     <param-name>load-class</param-name>
>     <param-value>
>       org.hsqldb.jdbcDriver
>       com.mysql.jdbc.Driver
>     </param-value>
>   </init-param>
> *
> the cocoon.xconf contain :
> *  <datasources>
>   <jdbc logger="core.datasources.personnel" name="personnel">
>     <pool-controller max="10" min="5"/>
>     <dburl>jdbc:hsqldb:hsql://localhost:9002</dburl>
>     <user>sa</user>
>     <password/>
>   </jdbc>
>   <jdbc name="ma_table_tbl" logger="core.datasources.ma_table_tbl">
>   <pool-controller min="5" max="10"/>
>   <dburl>jdbc:mysql://localhost/ma_table_tbl</dburl>
>   <user>username</user>
>   <password>password</password>
>   </jdbc>
> </datasources>
> *
> my xsp file contains :
> *<?xml version="1.0" encoding="iso-8859-1"?>
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> xmlns:esql="http://apache.org/cocoon/SQL/v2">
> <liste_mc>
>   <esql:connection>
>       <esql:driver>com.mysql.jdbc.Driver</esql:driver>
>   <esql:dburl>jdbc:mysql://localhost/ma_table_tbl</esql:dburl>
>   <esql:username>username</esql:username>
>   <esql:password>password</esql:password>
>       <esql:execute-query>
>       <esql:query>
>           SELECT type FROM type_tbl
>       </esql:query>
>       <esql:results>
>           <esql:row-results>
>               <type><esql:get-string column="type"/></type>
>       </esql:row-results>
>       </esql:results>
>       <esql:error-results><erreure>erreure</erreure></esql:error-results>
>       <esql:no-results><pasres>no result</pasres></esql:no-results>
>   </esql:execute-query>
>   </esql:connection>
> </liste_mc>
> </xsp:page>
> *
> The query works properly when i use it in command-line, the cocoon-xsp
> work properly (i try it with a script of factorial calculus).
> The problem is tha there is no connection to my database (the
> long-format log of mysql is not informed of this kind of connection) and
> the WEB-INF/log/error.log says :
> 
> *ERROR   (2003-06-17) 19:34.44:382   [core.manager]
> (/cocoon/mount/xsp/form_recherche.xsp) Thread-10/sitemap_xmap: Sitemap
> org.apache.cocoon.ProcessingException: Exception in
> ServerPagesGenerator.generate(): java.lang.RuntimeException: Error
> opening connection to dburl: jdbc:mysql://localhost/ma_table_tbl: Server
> configuration denies access to data source
>   at 
> org.apache.cocoon.generation.ServerPagesGenerator.generate(ServerPagesGenerato
> r.java:270)
> *
> 
> I search the web and the mail archive but i don't find any response.
> I search the answer since three days and i become to be a little bit
> upset...
> If someone can help me..
> thx a lot
> Alex
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 


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


Mime
View raw message