Solved

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

Posted on 2016-10-05
7
52 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
ID: 41830198
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 40

Expert Comment

by:Kyle Abrahams
ID: 41830324
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
ID: 41830409
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 40

Expert Comment

by:Kyle Abrahams
ID: 41830599
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
ID: 41830992
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
ID: 41844994
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 40

Expert Comment

by:Kyle Abrahams
ID: 41845854
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Disable extension 8 38
Help with exporting to excel 4 27
VB.Net Tranfer data between to VB.Net apps 8 25
Calculate number of nights between two dates 5 21
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

776 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