You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by fr...@virgilio.it on 2001/07/04 19:50:24 UTC

mySQL, jdbc and ESQL

Hi,
I'm trying to setup a pooled connection for mySQL.

My packets: JDK 1.3.1, Tomcat 4 beta5, Cocoon 2 beta1, mySQL 3.23.38, 
mm.mysql 2.0.6.1 on Linux Red Hat 6.2.

I've created a db named "test" with user "fku"
and table "utenti".
Then I've added these lines to cocoon.xconf
------
<datasources>
    <jdbc name="personnel">
      <pool-controller min="5" max="10"/>
      <dburl>jdbc:mysql://localhost/test</dburl>
      <user>fku</user>
      <password></password>
    </jdbc>
  </datasources>       
------

And these to WEB-INF/web.xml
------
<init-param>
      <param-name>load-class</param-name>
      <param-value>
      org.gjt.mm.mysql.Driver
      </param-value>
</init-param>
------

I've put mm.mysql-2.0.6.1.jar in TOMCAT_HOME/lib and CLASSPATH contains the 
path to mm.mysql's dir /opt/mm.mysql-2.0.6.1.

This is my XML code:
------
<xsp:page
        laguage="java"
        xmlns:xsp="http://www.apache.org/1999/XSP/Core"
        xmlns:esql="http://apache.org/cocoon/SQL/v2"
>
...
<esql:connection>
<esql:driver>org.gjt.mm.mysql.Driver</esql:driver>
        <esql:dburl>jdbc:mysql://localhost/test</esql:dburl>
        <esql:username>fku</esql:username>
        <esql:password></esql:password>
        <esql:execute-query>
                <esql:query>select * from prova</esql:query>

                <esql:results>
                        <ROWSET>
                         <esql:row-results>
                          <ROW>
                           <esql:get-columns/>
                          </ROW>
                         </esql:row-results>
                        </ROWSET>
                </esql:results>

        </esql:execute-query>
</esql:connection>
------

Please, see the mySQL's localhost.log:
------
/opt/mysql/libexec/mysqld, Version: 3.23.38-log, started with:
Tcp port: 3306  Unix socket: /tmp/mysql.sock
Time                 Id Command    Argument
010703 15:35:08       1 Connect     fku@localhost as anonymous on
                      1 Init DB     test
010703 15:35:16       1 Query       SHOW VARIABLES
010703 15:35:42       2 Connect     fku@localhost as anonymous on
                      2 Init DB     test
                      2 Query       SHOW VARIABLES
                      3 Connect     fku@localhost as anonymous on
                      3 Init DB     test
                      3 Query       SHOW VARIABLES
010703 15:35:43       4 Connect     fku@localhost as anonymous on
                      4 Init DB     test
                      4 Query       SHOW VARIABLES
010703 15:35:44       5 Connect     fku@localhost as anonymous on
                      5 Init DB     test
                      5 Query       SHOW VARIABLES
------

And, finally, cocoon.log:
------
...
2001-07-03 15:28:52 DEBUG   1539    [cocoon  ] (HttpProcessor[8080][4]): Trying
to load class: org.gjt.mm.mysql.Driver
...
2001-07-03 15:35:42 DEBUG   41112   [cocoon  ] (Thread-7): JdbcConnection object created

2001-07-03 15:35:42 DEBUG   41155   [cocoon  ] (Thread-7): JdbcConnection object created

2001-07-03 15:35:43 DEBUG   41206   [cocoon  ] (Thread-7): JdbcConnection object created

2001-07-03 15:35:44 DEBUG   41311   [cocoon  ] (Thread-7): JdbcConnection object created

2001-07-03 15:35:45 DEBUG   41396   [cocoon  ] (Thread-7): JdbcConnection object created
...
------

But I receive ESQL code in final HTML directly, without any query 
execution, so my HTML document contains these lines:
------
org.gjt.mm.mysql.Driver jdbc:mysql://localhost/test fku
select * from prova
------

It seems that the pooled connection is established, but ESQL code
isn't recognized by C2.

I've missed anything?
Any idea?

Thanks in Advance
Regards, ciao
Francesco


Francesco Casalena
L.U.G. "Il Pinguino"
----------------------------------------------
Virgilio Mail - Il tuo indirizzo E-mail gratis
http://mail.virgilio.it


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


Re: mySQL, jdbc and ESQL

Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 4 Jul 2001 francesco.casalena@virgilio.it wrote:

> This is my XML code:
> ------
> <xsp:page
>         laguage="java"
>         xmlns:xsp="http://www.apache.org/1999/XSP/Core"
>         xmlns:esql="http://apache.org/cocoon/SQL/v2"
> >
> ...
> <esql:connection>
> <esql:driver>org.gjt.mm.mysql.Driver</esql:driver>
>         <esql:dburl>jdbc:mysql://localhost/test</esql:dburl>
>         <esql:username>fku</esql:username>
>         <esql:password></esql:password>
>         <esql:execute-query>
>                 <esql:query>select * from prova</esql:query>
>
>                 <esql:results>
>                         <ROWSET>
>                          <esql:row-results>
>                           <ROW>
>                            <esql:get-columns/>
>                           </ROW>
>                          </esql:row-results>
>                         </ROWSET>
>                 </esql:results>
>
>         </esql:execute-query>
> </esql:connection>

note you're not even using the connection pool you created, but that's
beside the poitn. the problem seems to be the the esql:connection element
doesn't fall underneath a real element, it's right underneath xsp:page.

- donald


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