?
Solved

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

Posted on 2016-10-05
7
Medium Priority
?
78 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 2000 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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

719 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