cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robin Green" <gree...@hotmail.com>
Subject Re: Help! connecting to a database
Date Sat, 04 Nov 2000 20:27:50 GMT
Sorry if this reply is a bit redundant but there were some things which I 
don't think have been mentioned.

"Sergei O . Naumov" <naumov@r-style.donpac.ru> wrote:
>Hi!
>I am starting to develop a large Cocoon based project that needs to query a
>database
>(it will probably be Oracle). The question I have is on the good way to 
>connect
>to
>a database from XSP. In a servlet world, one connects to a database on the
>startup
>and uses this db handle to eliminate db connection overhead.

Actually no, it's not that simple, because connections may time out and 
should not be used by multiple threads simultaneously. So instead you would 
use a connection pool. Cocoon has just such a connection pool, which can be 
used either in your own code or by the sql or esql taglibs:

http://xml.apache.org/cocoon/connection-pool.html

>I was thinking on having a taglib that would implement all the Java methods
>that
>work with a database, and just use those in my XSP pages.

No need to reinvent the wheel. The esql taglib performs the hard work, and 
lets you insert arbitrary preprocessing logic by using esql:get-string etc. 
- totally flexible.

>Can anyone give some sort of suggestion on how to go around this? It would 
>be
>just
>wonderful if there are some code examples on that.

samples/sql/esql.xsl

You'll need at least Cocoon 1.8 of course.



_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.


Mime
View raw message