Re: Store SqlConnection in SessionVariable

From: Hans Kesting (news.2.hansdk_at_spamgourmet.com)
Date: 04/16/04


Date: Fri, 16 Apr 2004 13:58:11 +0200


"Rolf Gossen" <rolf.gossen@gmx.de> wrote in message news:d30e195.0404160340.4df85abd@posting.google.com...
> Hello NG,
>
> sometimes I read: "Never store an SqlClient.SqlConnection in a Session
> Variable." But noone explains why. Is there anyone who can briefly
> summarize the main problems about this approach.
>
> Thanks in advance
> Rolf

If you store opened connections, then you might run out of connections
when the site is moderately busy.
If you close the connection as soon as possible, then the built-in
connection pooling will prevent this problem. Also the pooling
makes sure that new connections are made quickly, so there is
(almost?) no penalty in closing the connection.

In the COM+/ASP world there were even bigger problems with storing
(COM/COM+) objects in the session.

Hans Kesting



Relevant Pages

  • ADO Interop - SQL Server 2000 connections not released
    ... - DB is SQL Server 2000 ... When the ASP page is executed...no matter how many calls to the COM+ ... objects, connections, recordsets, etc. are properly set to nothing upon exit. ... We have tried OLE DB Services=-4 to disable connection pooling and the ...
    (microsoft.public.data.ado)
  • DBCP + Weblogic = Runaway Leaks. Please help
    ... I'm facing a serious issue with connection pooling and I'd appreciate ... My dev environment uses Tomcat ... So instead of defining my datasources in an XML ... INACTIVE connections to my main Oracle DB in 1 node and about 3 in the ...
    (comp.lang.java.databases)
  • Re: Connection Pooling
    ... the app. ... Since all connections have to be killed anyway, ... > Part of the app is a 'Restore from Backup' form which uses SQLDMO code. ... > I'm starting to think it's to do with connection pooling because the open ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: New Connection on nested calls?
    ... bit confused about the connection pooling. ... >connections are drawn from the pool. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Slow performance after restarting
    ... - 9 connections implies to me 9 concurrent server process or independant ... When you are doing a startup, ... Why are you issuing DML at startup? ... For connection pooling, the connection is supposed to be in the same state ...
    (microsoft.public.sqlserver.programming)