I am using a foreach loop in SSIS to iterate over the contents of a folder, executing a SQL Task for each file.
When I do this, it works fine the first ~300 times through the loop, then it hangs and says:
Error: 0xC002F210 at ______, Execute SQL Task: Executing the query "[__].[dbo].[_______]" 开发者_如何学C
failed with the following error: "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.". Possible failure reasons: Problems with the
query, "ResultSet" property not set correctly, parameters not set correctly, or connection not
established correctly.
I'd imagine that this means that the old tasks are closing too slowly? The real kicker is that if I then add another SQL Task (inserting a blank string into a tmp table, using the same connection) before the task that is failing, the whole thing will work just fine. This isn't a good solution though, and I am hoping to figure out if there is a known workaround or if I am doing something very foolish.
There's an option in the connection manager to reuse the existing connection. Maybe changing this setting will help.
Select properties for your connection manager and set the RetainSameConnection property to True.
精彩评论