Hello.
Le mardi 29 mars 2005 à 10:00 -0500, Andrà ThÃnot a Ãcrit :
> Hi,
>
> I'm using flow to talk to my java model classes. So far so good.
> But I'd like my model classes to talk to the database and use
> cocoon's connection pool. Do I have to write an Avalon component for
> this? If so, how does one go about to do this (I don't know anything
> about writing those)?
The petstore block have this functionnality (the cocoon-petstore.jar
contains only the .js which do this), build the petstore without the
samples and:
cocoon.load("resource://org/apache/cocoon/components/flow/javascript/Database.js");
And, in your function:
try {
var conn = Database.getConnection("connectionName");
// On balance une serie de requete et on stocke les resultats
var content = conn.query("request, use ? as parameter",
[parameter ]).rows[0];
} finally {
conn.close();
}
look at the
cocoon-2.1.7/src/blocks/petstore/samples/flow/PetStoreImpl.js it has a
lot of database use in flows.
Rgds.
>
> Any pointers would be greatly appreciated.
> Thanks,
>
> Andre.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]