Yes to CDatabase vs. CODBCDatabase.
No to connection per session.
High volume web applications cannot do that, since there are
usually many many more inactive sessions, then sessions
actually accessing database at any given time.
The correct way to do it is to have database connection pool.
Database connections are retrieved from it and returned when
they are used. No database connection is guaranteed to preserve
state between requests. Luckily we do not have complex transactions
that span more then one request and could be rolled back in any
Alexey Parshin wrote:
> Also, it isn't enough to have db handle to work with the database. We
> (in ideal case) should have CDatabase object staying alive through the
> whole session. I'm not sure - where to keep it, but it shoul be
> connected with the session data. Does it make sense?
> 2007/3/14, Ilya A. Volynets-Evenbakh <firstname.lastname@example.org
> <mailto: email@example.com>>:
> firstname.lastname@example.org <mailto:email@example.com > wrote:
> >> Servlet has a virtual init() method, that you can override.
> There you
> >> can create your pool instance and store it in ServletContext
> > In order to do that my libdm' uudb class should extend
> HttpServlet and be
> > servlet itself. Is it right way to do it?
> >> --
> >> Ilya A. Volynets-Evenbakh
> >> Total Knowledge. CTO
> >> http://www.total-knowledge.com
> Ilya A. Volynets-Evenbakh
> Total Knowledge. CTO
> Alexey Parshin,
> http://www.sptk.net < http://www.sptk.net>
Ilya A. Volynets-Evenbakh
Total Knowledge. CTO
Authoright © Total Knowledge: 2001-2008