You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Philippe LAPLANCHE <ph...@horus-si.com> on 2007/05/15 16:41:17 UTC

RE: ScriptableConnection error

I'm also using ScriptableConnection. It used to work fine with cocoon 2.1.9 but from Cocoon 2.1.10 it doesn't work well anymore. 

You can see that the petstore sample doesn't work anymore from 2.1.10 ...

Apparently Cocoon developers had to change the rhino version and because of small differences between the 2 versions, the function Connection.query() now throws an exception when there is no parameter to the query.

I had to modify a bit the source file and I'm currently testing the attached version.


 

-----Message d'origine-----
De : Jason Johnston [mailto:cocoon@lojjic.net] 
Envoyé : lundi 14 mai 2007 16:31
À : users@cocoon.apache.org
Objet : Re: ScriptableConnection error

ypomonh wrote:
> I'm trying to see how ScriptableConnection works so I have a basic flow:
> 
>    
> importPackage(Packages.org.apache.cocoon.components.flow.javascript.ScriptableConnection); 
> 
> 
>    var db = Database.getConnection("myConnection");
>    var queryVal = cocoon.parameters["rid"];
>    var startRow = 0;
>    var maxRows = 100;
> 
>     row = db.query("select * from my_table where rid = ?", queryVal, 
> startRow, maxRows);
>     print (row.rowCount);
> 
> but I get the error:
> 
>    org.mozilla.javascript.EcmaError: "Database" is not defined
> 
> Am I missing something..? How should I define "Database"..?


The ScriptableConnection class is part of the petstore block, so you 
should look at that block's samples to see how they use it.  Looking 
briefly at it, it appears they import another JS file which itself 
defines the helper classes:

cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Database.js");

You'll need to make sure you have the petstore block jar in your build 
of course.

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

---------------------------------------------------------------------------------------
Orange vous informe que cet  e-mail a ete controle par l'anti-virus mail. 
Aucun virus connu a ce jour par nos services n'a ete detecte.