You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Mustapha Dada <da...@iskv.de> on 2000/11/24 16:25:12 UTC

Producer/esql/sql

Hello ,


the following producer works correctly :

URL is        :   http://localhost/xy.xml?producer=dummy2

I use here SQL Processor .

Producer is :


public class DummyProducer
  extends AbstractProducer
  implements Status
{

    String entity = request.getPrameter("entity") ;
    String database = request.getPrameter("database") ;

    String dummy =
                              "<?xml version=\"1.0\"?>"
                             +"<?cocoon-process type=\"sql\"?>"

                               ...

                           +"<connectiondefs>"
                           +"<connection name=\"foo_connection\">"
                           +"<driver>...DB2...Driver</driver>"
                           +"<dburl>jdbc.db2:http://localhost/"
                           +database     // will be determine dynamicly
through a HTML FORM
                           +"</dburl>"
                           +"<username>Administrator</username>"
                           +"<password>password</password>"
                           +"</connection>"
                           +"</connectiondefs>"

                           +"<query connection=\"foo_connection\">"
                           +"select * from  "
                           +entity  //  will be determine dynamicly
through a HTML FORM
                           +"</query>"



    public Reader getStream(HttpServletRequest request)
    throws IOException
  {
    return new StringReader(dummy);
  }

  public String getPath(HttpServletRequest request) {
    return "";
  }

  public String getStatus() {
    return "Dummy Producer";
  }
}

in this variant everything work correctly , that mean , i can often
choose - dynamicly -
any "database" or "entity" through my HTML FORM , cocoon retrieve the
right Data
without to entry a new dummy.xml  in my URL  :
http://localhost/dummy.xml?producer=dummy2

#############################################################################################

But when i use esql , the following not work correctely :



public class DummyProducer
  extends AbstractProducer
  implements Status
{

    String entity = request.getPrameter("entity") ;
    String database = request.getPrameter("database") ;

    String dummy =
                                    "<?xml version=\"1.0\"?>"



                                   +"<?cocoon-process type=\"xsp\"?>"

                                    +"<xsp:page "
                                    +"  language=\"java\" "

+"xmlns:esql=\"http://apache.org/cocoon/SQL/v2\" "

+"xmlns:xsp=\"http://www.apache.org/1999/XSP/Core\" >"


                                    +"<page>"
                                    +"<title>Test</title>"
                                       ...

                                    +"<esql:connection>"

                                    +"<esql:driver>DB2 ...
Driver</esql:driver>"

+"<esql:dburl>jdbc:db2:http://localhost/"
                                    +database
                                    +"</esql:dburl>"

+"<esql:username>Administrator</esql:username>"

+"<esql:password>passwd</esql:password>"

                                    +"<esql:execute-query>"
                                    +"<esql:query>select * from  "
                                    +entity
                                    +"</esql:query>"
                                    +"<esql:results>"
                                    +"<esql:row-results>"
                                    +"<b><esql:get-string
column="Name"/></b>"
                                    +"</esql:row--results>"
                                    +"</esql:results>"
                                    +"</esql:execute-query>"
                                    +"</esql:connection>
                                    +"</page>"

                                    +"</xsp:page>"



that Problem here is : the cocoon can the correctly Data only retrieve
when a new xml file is in the
URL entry http://localhost/new.xml?producer=dummy2 . By the same xml
file can cocoon with new entry
for the database and entity no new Data retrieve .

Question 1)

What mean dummy.xml in http://localhost/dummy.xml?producer=dummy2 ?

Question 2)
By esql :
cocoon can only the right Data retrieve - only by changing this
dummy.xml file . Why ?

Question 3)

What mean cache in cocoon ?
How to configure it - cache - ?



Thanks for your help .

Mustapha Dada