cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremy Aston" <>
Subject RE: Trying to connect mysql to cocoon2
Date Wed, 07 Nov 2001 07:53:33 GMT
Hi Feran,

I'm not quite sure I understand the problem but if you have set up the
connection information as below you can use the connection via ESQL in an
XSP page.  You will have an xsp page that contains the ESQL calls, either
directly or via a logicsheet.  You then transform this page with some XSL to
get your final output.  The documentation, "tutorial" examples (available as
part of the cvs code base at the moment - not on the rc1 distribution) and
cocoon welcome examples all demonstrate this.

If you are still having problems please be more explicit about them -
provide an example of exceptions, the code you are using etc.



  -----Original Message-----
  From: Ferran Urgell []
  Sent: 07 November 2001 07:38
  Subject: Re: Trying to connect mysql to cocoon2

  Thanks, for the answers,

  I've another question: What I need to put in the sitemap, because this is
not working.  I think that I'm very near of the connexion...If you have more
about this, or somtehing ....Thanks


    Jeremy Aston <> wrote:

     Hi Ferran,

    It's not too difficult to do.  I have done mine on an windows platform
but the changes should be the same for Linux.

    I'm using the mm jdbc driver - mm.mysql-2.0.4-bin.jar - which you can
download from  Put this jar into your
$TOMCAT_HOME/webapps/cocoon/WEB-INF/lib folder.  There is another mm jdbc
driver but this looks to be older to me - I can't tell from a cursory look
at the docs which is the best one to use so if anyone can shed some light on
this then please do.

    In WEB.XML find the existing hsqldb entry or add a new init-param
construct to do a load-class.  The class you need to load is
"".  It should look something like:


          <!-- For Database Driver: -->


    In COCOON.XCONF comment out or remove the hsqlbb-server construct
(assuming you are not using it).

    Find the datasources construct and put the JDBC url setting in there

        <jdbc name="xcpt">
          <pool-controller min="5" max="10"/>
              If you need to ensure an autocommit is set to true or
          false, then create the "auto-commit" element below.


          The default is true.
          <dburl>jdbc:mysql://<IP ADDRESS>:3306/xcpt</dburl>


    This is assuming you are on port 3306.  note the JDBC datasource name
"xcpt" and the reference to the "xcpt" database in the JDBC url.  Obviously
these will be different in your case, as will the username/password.  The
datasource name is what you need to use in your ESQL.  I have also noticed
that the you must put in a proper ip address.  I think I need to tweak my
server config as it does not recognise a host name, localhost or
in there.  I'm new to mysql as well so I am sure it is a small config issue.

    The following ESQL shows how you can call the above connection

        <esql:query>SELECT title, description FROM page</esql:query>
                 <td><esql:get-string column="title"/></td>
                 <td><esql:get-string column="description"/></td>
           <p>Sorry, no results!</p>

    Note  the use of the same pool name as your JDBC datasource name.

    That's it - should work!


    Ferran Urgell <> wrote:

      Hi, everybody!

      Well, I'm trying to connect in a database mysql (in linux) and I would
to know, more about this.

      What can I do for to do this ?

      If there are somebody, that are made this before, please send me an



      Do You Yahoo!?
      Find a job, post your resume on Yahoo! Careers.

    Do You Yahoo!?
    Get personalised at My Yahoo!.

  Do You Yahoo!?
  Find a job, post your resume on Yahoo! Careers.

View raw message