Return-Path: Delivered-To: apmail-cocoon-users-archive@www.apache.org Received: (qmail 78669 invoked from network); 16 Dec 2003 00:08:45 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 16 Dec 2003 00:08:45 -0000 Received: (qmail 23956 invoked by uid 500); 16 Dec 2003 00:08:22 -0000 Delivered-To: apmail-cocoon-users-archive@cocoon.apache.org Received: (qmail 23826 invoked by uid 500); 16 Dec 2003 00:08:22 -0000 Mailing-List: contact users-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: users@cocoon.apache.org Delivered-To: mailing list users@cocoon.apache.org Received: (qmail 23811 invoked from network); 16 Dec 2003 00:08:21 -0000 Received: from unknown (HELO kogut.o2.pl) (212.126.20.60) by daedalus.apache.org with SMTP; 16 Dec 2003 00:08:21 -0000 Received: from [192.168.2.124] (r4ds.p.lodz.pl [212.191.78.94]) by kogut.o2.pl (o2.pl Mailer 2.0.1) with ESMTP id 228981A3446 for ; Tue, 16 Dec 2003 01:08:28 +0100 (CET) Subject: Re: How to obtain db connection from pool ? From: Mariusz Sieraczkiewicz To: users@cocoon.apache.org In-Reply-To: <3FDE34BB.2050707@o2.pl> References: <3FDB87BB.9080607@o2.pl> <3FDE34BB.2050707@o2.pl> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 (1.0.8-10) Date: 16 Dec 2003 01:08:27 +0100 Message-Id: <1071533308.10984.12.camel@bims> Mime-Version: 1.0 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N There are two possibities I know: 1) flowscript 2) Avalon Component. Please give some context. I guess the flowscript is the easiest solution, I've adopted it from the code of database action, and it looks almost the same (but written in javascript instead of java). Because Cocoon is Avalon based I dont think there's other (non-Avalon) possibility to achieve what you asked. Flowscript gives you access to some Cocoon Avalon Components, which you can make use of mixing with your own java components (not necesserily Avalon Components). I did so and it works. Regards Mariusz Sieraczkiewicz. BTW It's very funny to write in English to Polish folk ;-) On Mon, 2003-12-15 at 23:24, Marcin Okraszewski wrote: > Hi, > And how about obtaining it outside a flow? How to get the instance of > the component selector that I could run something similar to > cocoon.getComponent() from the example below? > > Regards, > Marcin Okraszewski > > > Suggested using flowscript, then try sth like this: > > > > try { > > var dbSelector = > > cocoon.getComponent(Packages.org.apache.avalon.excalibur.datasource.DataSourceComponent.ROLE > > + "Selector"); > > var dataSrc = dbSelector.select("your counnection"); > > conn = dataSrc.getConnection(); > > > > // your stuff > > } > > catch (e) { > > e.toString(); > > } > > finally { > > if (conn != null) { > > conn.close(); > > conn = null; > > } > > > > if (dbSelector != null) { > > cocoon.releaseComponent(dbSelector); > > dbSelector = null; > > } > > } > > > > But if you write Avalon Component, just look at database actions sources. > > > > Regards > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > > For additional commands, e-mail: users-help@cocoon.apache.org > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org > For additional commands, e-mail: users-help@cocoon.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org For additional commands, e-mail: users-help@cocoon.apache.org