Solved

Timeout expired elapsed prior to obtaining a connection from the pool Winforms App

Posted on 2016-10-05
7
33 Views
Last Modified: 2016-10-31
I am getting the timeout expired elapsed prior to obtaining a connection from the pool error on a winforms app compiled on VS2010 .net 4.  I don't get this error on every computer using the program though.  I can run the same process and only get this error on 2 out of 10 computers or so.  All computers run remote, windows 7-10.  SQL server 2008.  I can't find any rim or reason to which ones work or don't work.  I am using use statements in the code.  What could I look for on the machines.  I have 2 computers in one office, one works one doesn't.  Both windows 10 64 bit.  Same fire wall, and antivirus settings.

Any suggestions on what I might be missing.
0
Comment
Question by:PDIS
7 Comments
 
LVL 20

Expert Comment

by:Russ Suter
Comment Utility
What is your timeout set at? If you increase it does the problem go away? This might help determine whether you have a slow connection or something is just flat blocking things.
0
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
Also are you running sql express or an actual copy of sql?  Could be concurrent connections if you're running express.

Can you ping the sql server / connect to it from management studio when you get the time out?
0
 

Author Comment

by:PDIS
Comment Utility
I moved the timeout to 120 seconds,  Based on screen updates it is processing when I get the pooling error.

Actually copy of SQL server 2008 STD.  I can still ping and connect when I get the timeout/pooling message.  I have even increases the number of pools to 200, just to see if it would finish.

I have a couple computers that will consistently get the error.  .net4 frame work.  Does it matter if or what very of the native sql client is installed.  From all my research, .net uses it own system.data.dll

Then I can run the same process on the same data on a different machine and it works just fine.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
Are you closing and disposing of the connections?  It could be more a matter of garbage collection?
0
 
LVL 12

Accepted Solution

by:
funwithdotnet earned 500 total points
Comment Utility
I think Kyle might be correct. Are you using the 'Using' statement for System.Data.SqlClient.SqlConnection and System.Data.SqlClient.SqlCommand?

            Using myConnection As SqlConnection = New SqlConnection(connectionString)
                Using myCommand As New SqlCommand(queryCommandString, myConnection)
                    Try
                        ' execute commands

                    Catch ex As Exception

                    End Try
                End Using
            End Using 

Open in new window

0
 

Author Comment

by:PDIS
Comment Utility
Kyle and funwithdotnet, I noticed not all places where using, using statements.  I took over the code from someone else, and I guess I didn't dig far enough.  Thank out for pointing in the right direction.  I do have a question, that we I search on everyone has a dinner opinion on.
                                                Try
                                                    Using conn As New SqlConnection(My.Settings.connStr)
                                                        Using cmd As New Data.SqlClient.SqlCommand(sqlSalesInsert, conn)
                                                            conn.Open()
                                                            cmd.ExecuteNonQuery()
                                                        End Using
                                                    End Using
                                                Catch ex As Exception
                                                End Try

Open in new window


This method or funs method which is actually better?
0
 
LVL 39

Expert Comment

by:Kyle Abrahams
Comment Utility
If you need access the variables inside the using statement then try inside of the using statement is your only option.  (EG: Once you leave the using the variables become out of scope).

If you don't need access to the variables then outside is fine.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now