Re: sql connection errors as usage increases

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 08/24/04


Date: Tue, 24 Aug 2004 14:37:37 -0700

I suspect that you have a hole in your logic that permits a connection to be
opened but not closed as you suspect.

-- 
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"kkres" <kkres@discussions.microsoft.com> wrote in message 
news:9F344E8F-A6E8-46D1-BEDF-B33A97590C47@microsoft.com...
>I own an ASP .NET application that uses ADO.NET to manage SQLConnections to 
>a
> SQL Srvr 2000 database. Until recently the app has been working fine
> (with a very small number of users). But in recent weeks number of users 
> has
> dramatically increased, and now the site is reporting this frequent error:
>
> System.InvalidOperationException: Not allowed to change the
> 'ConnectionString'
> property while the connection (state=Open). at
> System.Data.SqlClient.SqlConnection.set_ConnectionString(Stringvalue)
> at ... in ...basApplication.vb:line 89
>
> It occurs as the user login and the app is creating 2 connections strings
> for use during the user's session. The code in question is essentially:
>
>    Public gobjConn As New
> SqlClient.SqlConnection(ConfigurationSettings.AppSettings("dsn"))
>    Public gobjConn2 As New
> SqlClient.SqlConnection(ConfigurationSettings.AppSettings("dsn"))
> -
> -
>    gobjConn.Close()
>    gobjConn2.Close()
> -
> -
>    gobjConn.ConnectionString = strDataSource & strDataBase & "UID=fred;" &
> "PWD=xyz;"
>    gobjConn2.ConnectionString = strDataSource & strDataBase & "UID=fred;" 
> &
> "PWD=xyz;"   (line 89)
>
>    gobjConn.Open()
>    gobjConn2.Open()
>
> The connection strings are identical (same server and db) and exactly the
> same (same login and pw) for all users.
>
> I had thought that the Close operations before the Opens would always 
> assure
> that no connection would ever be left open.
>
> This site has been able to live with the problem by regularly restarting 
> IIS.
>
> What am I missing?
>
> Thanks,
> -- 
> kkres 


Relevant Pages

  • Re: Problem with ER : cdr sync replicate
    ... I suspect that the 47 error is leading eventually to the other failures because logic is that when we are trying to destroy the part structure, that we attempt to connect to the server that the part is associated with and then perform a clean shutdown. ... I suspect that in UC4 that there is some issue with improper cleanup when the initial connection never occured. ... (nameIn should be the group name...) ...
    (comp.databases.informix)
  • Re: Trigger-happy Met Armed Cops still havent learned to stop behaving like armed thugs
    ... some connection with the raid was wrong. ... appeared in the middle of an attempt to arrest some one who may be armed and may already have shot two people could neither disrupt the operation or be at risk from the operation was wrong ... I am suggesting that only the suspect, ...
    (uk.legal)
  • Re: Memory problem - writing to database
    ... > take a lot of resource to keep opening and closing the db connection? ... I'm not even sure that ADO classic doesn't have a clever form of connection ... I also strongly suspect that by ... Don't worry about the fact that you're constantly opening new connections - ...
    (microsoft.public.vb.general.discussion)
  • Re: Connection Failure
    ... I also suspect the connection pool might be an issue. ... If you suspect the new server, ... > when executing various select statements on a SQL2000 database using ADO ...
    (microsoft.public.data.ado)
  • Re: If running for a train with a rucksack now carries the death sentence.....
    ... > The pertinent questions are: Why did they follow someone not connected ... > underground station in preference to somewhere more appropriate? ... Apparently the 'suspect' came out of a house that was under surveillance. ... That alone would be enough reason to suspect a connection. ...
    (uk.radio.amateur)