Re: OleDBConnection problem if database sesison is killed or database is restarted

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Miha Markic [MVP C#] (miha)
Date: 02/09/04


Date: Mon, 9 Feb 2004 09:04:25 +0100


> We will catch that exception and then I want to reset my connection
> pool(connection pool maintained by OleDB).
> Is there is any method to reset connection pool?

Unfortunatelly nope.

> Solutions I tried:
> 1. On catching 'System.Data.OleDb.OleDbException: Session
> closed/terminated', I append some dummy parameters
> to the existing string like this:
> myConnectionString = myConnectionString + ";a=b;" //
> "a=b;"
> is a dummy key-val appended
> Here it works fine bcoz the changes in connection string results in
> new
> OleDB connection pool.
>
> 2. I tried by putting extra sapaces in connection string, but it
> doesnot
> work. (OleDB removes all extra white spaces from the connection
> string)

> Query:
> Is this a correct method to change connection string by using some
> dummy
> values(as explained in sol 1)?
> OR is there any alternative way of doing the same?

I guess that not recognized values would be ignored, so it makes sense.
However, there is normally only one connection in the pool (by default) if
you are not multithreading.
So, theoretically you would get only one exception (that connection is bad)
and when you retry with the same connection string it should reopen a new
one for you.

-- 
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com


Relevant Pages

  • RE: Connection pooling
    ... Connection Pooling with SQL Server 2000 Analysis Services ... the Microsoft XML for Analysis Provider to develop scalable client and Web ... applications for Microsoft SQL Server 2000 Analysis Services. ... Balancing and Shrinking the Connection Pool ...
    (microsoft.public.sqlserver.programming)
  • Re: SQL Compact Edition - Connection Pool --> Slow!
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... mind (--> get a connection, use it and release it as soon as possible ... about the connection pool for Compact Edition 3.1. ...
    (microsoft.public.sqlserver.ce)
  • Re: SQL Compact Edition - Connection Pool --> Slow!
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... mind (--> get a connection, use it and release it as soon as possible ... about the connection pool for Compact Edition 3.1. ...
    (microsoft.public.sqlserver.ce)
  • Re: ASP.NET SQL Processes
    ... Microsoft Online Support ... when we use the ADO.NET's connection ... | connection pool, when we create SqlConnections, the ADO.NET will retrieve ... | | SQL server doesn't keep any processes attached to the application. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: SQL Compact Edition - Connection Pool --> Slow!
    ... Hitchhiker's Guide to Visual Studio and SQL Server ... and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook) ... The question I have is related to connection together with multithreading. ... the connection pool for Compact Edition 3.1. ...
    (microsoft.public.sqlserver.ce)