ASP.NET SQL Processes

Discussion in 'ASP .Net' started by =?Utf-8?B?VGltOjouLg==?=, Sep 1, 2005.

  1. Can someone please tell me how I get around this???

    I have an ASP.NET web application that uses an SQL 2000 database for the
    majority of the web sites content... If the application comes up with an
    error the process on the SQL server remains alive. How do I make sure that
    the process is killed on the SQL server even if there is an error???

    I guess you use "TRY" but am new to asp.net programming and would appritiate
    any examples or suggestions...

    Thanks
    =?Utf-8?B?VGltOjouLg==?=, Sep 1, 2005
    #1
    1. Advertising

  2. Hi Tim,

    I think the "process" you mentioned maybe means the "connection" from the
    client application which made between the client and server. Yes, there may
    occur such connection leak when we didn't protect the code well in our data
    accessing application. In .NET, when we use the ADO.NET's connection
    objects to connect SQLServer or other DB, the .NET will internally manage a
    connection pool, when we create SqlConnections, the ADO.NET will retrieve
    connection from the pool if there is existing connection available,
    otherwise, creating new connection and pool it into the pool. So in our
    applicaiton which performing data access through ADO.NET, we just need to
    make sure, we call connection.Close to release the connection (release it
    back to the .net's internal conneciton pool's management) after we
    finishing used it. In your scenario, you'd like to make sure database
    connection get relesed when there occurs unexpected exceptions, I think you
    can consider wrapper your data accessing code into the classic

    try .... catch...finally code block, for example:

    [c#]

    SqlConnection conn;
    SqlCommand comm;

    try
    {
    conn = new SqlConnection (....);
    } catch( xxxException ex)
    {
    ......
    }finally
    {
    //DataReader.close if exist
    conn.close();
    }

    all the code in finally block will be guranteed to get executed. Also, in
    C# , there exist the
    Using(SqlConnection conn = new .....)
    {
    ....
    }

    Using statement will ensure that the object create in the (..) will be
    guranteed to release after the execution section.

    #using Statement
    http://msdn.microsoft.com/library/en-us/csref/html/vclrfusingstatement.asp?f
    rame=true

    Here is another msdn reference describing the .NET's connection pool
    regarding on SQLServer:

    #The .NET Connection Pool Lifeguard
    http://msdn.microsoft.com/library/en-us/dnsqlmag03/html/The_NETConnectionPoo
    lLifeguard.asp?frame=true

    Hope also helps. Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)








    --------------------
    | From: "Eliyahu Goldin" <>
    | References: <>
    | Subject: Re: ASP.NET SQL Processes
    | Date: Thu, 1 Sep 2005 11:47:27 +0200
    | Lines: 22
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
    | Message-ID: <O#>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | NNTP-Posting-Host: 212.143.94.2
    | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet:121657
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    |
    | SQL server doesn't keep any processes attached to the application. It just
    | serves data access requests select/update/insert/delete. It doesn't care
    of
    | the application errors.
    |
    | Eliyahu
    |
    | "Tim::.." <> wrote in message
    | news:...
    | > Can someone please tell me how I get around this???
    | >
    | > I have an ASP.NET web application that uses an SQL 2000 database for the
    | > majority of the web sites content... If the application comes up with
    an
    | > error the process on the SQL server remains alive. How do I make sure
    that
    | > the process is killed on the SQL server even if there is an error???
    | >
    | > I guess you use "TRY" but am new to asp.net programming and would
    | appritiate
    | > any examples or suggestions...
    | >
    | > Thanks
    |
    |
    |
    Steven Cheng[MSFT], Sep 1, 2005
    #2
    1. Advertising

  3. SQL server doesn't keep any processes attached to the application. It just
    serves data access requests select/update/insert/delete. It doesn't care of
    the application errors.

    Eliyahu

    "Tim::.." <> wrote in message
    news:...
    > Can someone please tell me how I get around this???
    >
    > I have an ASP.NET web application that uses an SQL 2000 database for the
    > majority of the web sites content... If the application comes up with an
    > error the process on the SQL server remains alive. How do I make sure that
    > the process is killed on the SQL server even if there is an error???
    >
    > I guess you use "TRY" but am new to asp.net programming and would

    appritiate
    > any examples or suggestions...
    >
    > Thanks
    Eliyahu Goldin, Sep 1, 2005
    #3
  4. Hi Tim,

    Have you had a chance to look at the suggestions in my last reply or have
    you got any further ideas on this issue? If there're any further things we
    can help, please feel free to post here.

    Thanks,

    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | X-Tomcat-ID: 158848602
    | References: <>
    <O#>
    | MIME-Version: 1.0
    | Content-Type: text/plain
    | Content-Transfer-Encoding: 7bit
    | From: (Steven Cheng[MSFT])
    | Organization: Microsoft
    | Date: Thu, 01 Sep 2005 09:13:15 GMT
    | Subject: Re: ASP.NET SQL Processes
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | Lines: 95
    | Path: TK2MSFTNGXA01.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet:121662
    | NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
    |
    | Hi Tim,
    |
    | I think the "process" you mentioned maybe means the "connection" from the
    | client application which made between the client and server. Yes, there
    may
    | occur such connection leak when we didn't protect the code well in our
    data
    | accessing application. In .NET, when we use the ADO.NET's connection
    | objects to connect SQLServer or other DB, the .NET will internally manage
    a
    | connection pool, when we create SqlConnections, the ADO.NET will retrieve
    | connection from the pool if there is existing connection available,
    | otherwise, creating new connection and pool it into the pool. So in our
    | applicaiton which performing data access through ADO.NET, we just need to
    | make sure, we call connection.Close to release the connection (release it
    | back to the .net's internal conneciton pool's management) after we
    | finishing used it. In your scenario, you'd like to make sure database
    | connection get relesed when there occurs unexpected exceptions, I think
    you
    | can consider wrapper your data accessing code into the classic
    |
    | try .... catch...finally code block, for example:
    |
    | [c#]
    |
    | SqlConnection conn;
    | SqlCommand comm;
    |
    | try
    | {
    | conn = new SqlConnection (....);
    | } catch( xxxException ex)
    | {
    | ......
    | }finally
    | {
    | //DataReader.close if exist
    | conn.close();
    | }
    |
    | all the code in finally block will be guranteed to get executed. Also,
    in
    | C# , there exist the
    | Using(SqlConnection conn = new .....)
    | {
    | ....
    | }
    |
    | Using statement will ensure that the object create in the (..) will be
    | guranteed to release after the execution section.
    |
    | #using Statement
    |
    http://msdn.microsoft.com/library/en-us/csref/html/vclrfusingstatement.asp?f
    | rame=true
    |
    | Here is another msdn reference describing the .NET's connection pool
    | regarding on SQLServer:
    |
    | #The .NET Connection Pool Lifeguard
    |
    http://msdn.microsoft.com/library/en-us/dnsqlmag03/html/The_NETConnectionPoo
    | lLifeguard.asp?frame=true
    |
    | Hope also helps. Thanks,
    |
    | Steven Cheng
    | Microsoft Online Support
    |
    | Get Secure! www.microsoft.com/security
    | (This posting is provided "AS IS", with no warranties, and confers no
    | rights.)
    |
    |
    |
    |
    |
    |
    |
    |
    | --------------------
    | | From: "Eliyahu Goldin" <>
    | | References: <>
    | | Subject: Re: ASP.NET SQL Processes
    | | Date: Thu, 1 Sep 2005 11:47:27 +0200
    | | Lines: 22
    | | X-Priority: 3
    | | X-MSMail-Priority: Normal
    | | X-Newsreader: Microsoft Outlook Express 6.00.2800.1506
    | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506
    | | Message-ID: <O#>
    | | Newsgroups: microsoft.public.dotnet.framework.aspnet
    | | NNTP-Posting-Host: 212.143.94.2
    | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
    | | Xref: TK2MSFTNGXA01.phx.gbl
    | microsoft.public.dotnet.framework.aspnet:121657
    | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    | |
    | | SQL server doesn't keep any processes attached to the application. It
    just
    | | serves data access requests select/update/insert/delete. It doesn't
    care
    | of
    | | the application errors.
    | |
    | | Eliyahu
    | |
    | | "Tim::.." <> wrote in message
    | | news:...
    | | > Can someone please tell me how I get around this???
    | | >
    | | > I have an ASP.NET web application that uses an SQL 2000 database for
    the
    | | > majority of the web sites content... If the application comes up
    with
    | an
    | | > error the process on the SQL server remains alive. How do I make sure
    | that
    | | > the process is killed on the SQL server even if there is an error???
    | | >
    | | > I guess you use "TRY" but am new to asp.net programming and would
    | | appritiate
    | | > any examples or suggestions...
    | | >
    | | > Thanks
    | |
    | |
    | |
    |
    |
    Steven Cheng[MSFT], Sep 5, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jan nielsen

    Re: asp.net mysql sleeping processes

    jan nielsen, Jul 23, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    494
    jan nielsen
    Jul 23, 2003
  2. Jeff Rodriguez
    Replies:
    23
    Views:
    1,118
    David Schwartz
    Dec 9, 2003
  3. microsoft.public.sqlserver.programming

    sql processes multiplying

    microsoft.public.sqlserver.programming, Mar 19, 2007, in forum: ASP .Net
    Replies:
    4
    Views:
    353
    microsoft.public.sqlserver.programming
    Mar 23, 2007
  4. ecoolone
    Replies:
    0
    Views:
    755
    ecoolone
    Jan 3, 2008
  5. Marc Heiler
    Replies:
    1
    Views:
    173
    Robert Klemme
    May 24, 2009
Loading...

Share This Page