Re: OleDBConnection problem if database sesison is killed or database is restarted
From: Miha Markic [MVP C#] (miha)
Date: 02/09/04
- Next message: Miha Markic [MVP C#]: "Re: ODBC vs Ole Db"
- Previous message: Julian: "Mapping corresponding columns - again !!"
- In reply to: Jack Wright: "Re: OleDBConnection problem if database sesison is killed or database is restarted"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Miha Markic [MVP C#]: "Re: ODBC vs Ole Db"
- Previous message: Julian: "Mapping corresponding columns - again !!"
- In reply to: Jack Wright: "Re: OleDBConnection problem if database sesison is killed or database is restarted"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|