I posted this problem but no one responded. I figured I'd try one last time.
I'm having a wierd problem. I've been using Visual Studio.NET 2003, and writing an app that up to now has been working perfectly. All of a sudden an error comes up and have no idea what it means or how to stop it from happening. The error is: "Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occured because all pooled connections were in use and max pool size was reached."
OK, first of all the max pool size in SQL Server 2000 is set to unlimited. Next, in the code, I check the connection state just before I fill the data adapter (Step Through - F8) - and it's closed. So no unnecessary connections are open.
All that's not really the wierd part. The wierd thing is when I run the exe file from the bin directory in Windows Explorer (after building/compiling it) it all works PERFECTLY! But running it within the VS.NET environment - it gives me that error. Is this a service pack thing, me or does VS.NET run the same exact exe file differently than if running it by just double clicking on it in Windows Explorer
Driving me nuts. Thanks ahead of time,
Denvas

Can't anyone help me with this? - "..timeout period elapsed prior to obtaining a connection from the pool..."
Jeff Walsh
This was because I was opening and closing the connection inside a loop, and the available connections were over the limit i.e. 30.
One more approach could be that done open and close the connection inside the loop. Open it before the loop and close it after the loop. Anyways, thanx for help.
aalford
Thanks though,
Denvas
Najm
That did it.
Edward
Johan Delimon
That did it. I simply added Pooling=False to the connection string and it works. Its working pretty crappy mind you, but nonetheless functional. Still not understanding how a connection string is affected by how the project is compiled. But at this point I don't care anymore - as long as I can get back to work.
Thanks again,
Denvas
RS_Trans
ebc
i.e. Add ";Connection Lifetime=30" to your connection string. Timeout is now 30 seconds.
maxi_byte
Erro: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
If anyone has an answer - please help!
Thanks,
Anxiously Waiting
djalexd
http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpguide/html/cpconconnectionpoolingforsqlservernetdataprovider.asp
This is the info I could find on changing the pool settings but I'm at a loss to determine why it has just started when as far as I can tell nothing has changed in how this is configured.
regards,
Chris
tnyx
And i ve increased the pool size and decreased the connection timeout period. And the problem gone. I m not sure that is correct solution but, now i can breath :)
snktheone
Isn't it wierd that SO many people have seen this post; I'm sure by just those numbers, even a small percentage have had the same experience AND found a complete fix for this.
Can't believe no one can give me an explanation why running an app from within VS.NET would be different from running the same EXACT compiled exe from the bin directory (Windows Explorer). Usually a lot of experts on this forum.
- Denvas
Shane Gidley
System.Threading.Thread myThread = new System.Threading.Thread(new System.Threading.ThreadStart(executeSQL));
myThread.IsBackground=true;
myThread.Start();
public void executeSQL()
{
string myConStr = sqlConnection1.ConnectionString;
SqlConnection myConn = new SqlConnection(myConStr);
SqlCommand myCmd = new SqlCommand(sb.ToString(), myConn);
myConn.Open();
try
{
myCmd.ExecuteNonQuery();
}
catch(Exception ex)
{
System.Threading.Thread.CurrentThread.Suspend();
MessageBox.Show("Error executing SQL, possibly there was a character in the input that messed up the import. Please contact Thomas. Input string: "+sb.ToString()+"\nERROR:\n\n"+ex.ToString());
}
finally
{
myConn.Close();
}
}
CarlaOR
But, I got the basic idea - but it still makes me wonder why it works PERFECTLY when the compiled exe runs on a clients' computer or straight from the bin directory. BUT when I run it from within VB.NET 2003 (hitting F5) that's when I get problems. All I'm doing is getting data. And not from a particular call. If I simply skip one ExecuteScalar, and choose the next one - I get this problem either way (Again, only in VB.NET 2003 Ent. Arch.).
Is the VB.NET environment conflicting with my applications' process
I'm confused.
Were you getting your problem when opening the exe directly or within the design environment
thanks,
Denvas
Snake_122
Thanks,
Denvas
Digamber
http://msdn.microsoft.com/library/default.asp url=/library/en-us/dndotnet/html/progthrepool.asp
Anyway after poking around I found that I was calling a method in my timer tick event over and over and over again. I fixed this and it solved the problem.
hope this helps,
sivilian