cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From magnus.egnerf...@home.se
Subject Re: Problem with esql-taglib
Date Tue, 17 Oct 2000 12:13:38 GMT

> On Mon, 16 Oct 2000 magnus.egnerfors@home.se wrote:
> 
> >  I have a problem that I have been working on for a few days now so any
> > help solving this would be great. I'm running with cocoon-1.8.1-dev
> > (updated this morning/ unfortunately there is a problem with
> > turbine-pool.jar that I've posted to cocoon-dev list).
> 
> hope this is fixed now...
Yes.

> 
> > Here is my XML document (the document is a test page normally there should
> > be some xslt processing to add the html headers). The msisdn variable is
> > set in the session on the previous page and is fetched correctly.
> > 
> > -----XML document ----------
> > <?xml version="1.0"?>
> > 
> > <?cocoon-process type="xsp"?>
> > <?xml-logicsheet
> > href="resource://org/apache/cocoon/processor/xsp/library/java/session.xsl"?>
> > <?xml-logicsheet
> > href="resource://org/apache/cocoon/processor/xsp/library/sql/esql.xsl"?>
> > 
> > <xsp:page
> >   language="java"
> >   xmlns:xsp="http://www.apache.org/1999/XSP/Core"
> >   xmlns:session="http://www.apache.org/1999/XSP/Session"
> >   xmlns:esql="http://apache.org/cocoon/SQL/v2"
> > >
> > 
> > <page>
> > 
> > <html>
> > <body>
> > 
> > <P><session:get-attribute name="msisdn"/></P>
> > <P>select * from msisdn2contract where msisdn='<session:get-attribute name="msisdn"/>'</P>
> > 
> > <esql:execute-query inner-method="yes">
> > <esql:driver>oracle.jdbc.driver.OracleDriver</esql:driver>
> > <esql:username>sysadm</esql:username>
> > <esql:password>sysadm</esql:password>
> > <esql:dburl>processor.xsp.pool.database.default.url=jdbc:oracle:thin:@localhost:1521:ERWIN</esql:dburl>
> > <esql:query>select customerid from msisdn2contract where msisdn='<session:get-attribute
name="msisdn"/>'</esql:query>
> > <esql:results>
> > <P><esql:get-string column="customerid"/></P>
> > 
> > </esql:results>
> > <esql:no-results>
> >  <error>no results were found here either</error>
> > </esql:no-results>
> > <esql:error-results>
> >  <message><esql:get-message/></message>
> >  <stacktrace><esql:get-stacktrace/></stacktrace>
> > </esql:error-results>
> > </esql:execute-query>
> > 
> > 
> > </body>
> > </html>
> > </page>
> > 
> > </xsp:page>
> > 
> > ----------end xml doc -----------------------
> > 
> > This generates a page that looks like this:
> > 
> > ----------- output --------------
> > <page xmlns:session="http://www.apache.org/1999/XSP/Session">
> > 
> > <html>
> > <body>
> > 
> > <P>628882101</P>
> > <P>select * from msisdn2contract where msisdn='628882101'</P>
> > 
> > <error xmlns:session="http://www.apache.org/1999/XSP/Session">no results
> > were found here either</error>
> > 
> > </body>
> > </html>
> > </page>
> 
> that all looks fine. the query runs, the variable is retrieved from the
> session. what gives? 	

The previewed query shown above returns a correct result when running it
through sqlplus or any other tool for accessing the db.

[ ... snip removed java code ...]

> > 
> > Replacing the last get-attribute with a fixed value works perfectly fine
> > and the query returns the correct information.
> 
> so what, replacing String.valueOf("msisdn") with "msisdn" makes everything
> work? that's completely whacked - that strongly indicates a jvm
> error. i assert that String.valueOf("msisdn").equals("msisdn"). am i
> misunderstanding something?

What happens is if I replace the query that looks like this:

<esql:query>select customerid from msisdn2contract where
msisdn='<session:get-attribute name="msisdn"/>'</esql:query>

with 

<esql:query>select customerid from msisdn2contract where
msisdn='628882101'</esql:query>

the the query works as the result set is returned correctly.

I've have tested this with Java 2 SDK 1.3 Bete refresh for Linux and IBM
SDK 1.3-1.1 and no luck with either.

Any clues what might be wrong? 
How can I do some debugging to check/print the values in the generated
java code thats located in the repository. Just modify the source code and
access the page?

> 
> > Does the esql-block create its own session somehow and we lose the session
> > information???
> 
> nope. esql knows nothing whatsoever about sessions. it relies on
> xsl:apply-templates to invoke actions from other logicsheets.

I've noticed that in my testing. The session-id is the same in all parts
of the query.

/Magnus



Mime
View raw message