|
Home > Archive > MS SQL Server DTS > September 2005 > How Do You Explicitly Close a DTS Connection in VB.NET?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How Do You Explicitly Close a DTS Connection in VB.NET?
|
|
| Anonymous 2005-09-27, 8:24 pm |
| In my scenario, I have a VB.NET class that runs a DTS package. This
code has worked for years, but under heavy stress I am seemingly
running out of connections from the connection pool. This leads me to
believe that the connections being used by the DTS package are not
being freed up properly after a package has executed.
I know in ADO.NET, you must explicitly Close or Dispose the connection
in the Finally portion of a Try...Catch block. So, I am trying to
determine how to do the same thing with a DTS connection and how.
Consider the following abbreviated code:
-------------------------------------------
Dim objConnection As DTS.Connection2
Try
'...Initialize the package...
'Create package connection information
objConnection = objPackage.Connections.New("SQLOLEDB")
'...Configure the SQL connection...
objPackage.Connections.Add(objConnection)
objConnection = Nothing
objConnection =
objPackage.Connections.New("Microsoft.Jet.OLEDB.4.0")
'...Configure the Access connection
objPackage.Connections.Add(objConnection)
objConnection = Nothing
'...Construct and run the package steps...
Catch ex As Exception
'...Error handling code...
Finally
'...WHAT GOES HERE TO CLOSE THE CONNECTIONS AND PACKAGE?
End Try
| |
| Allan Mitchell 2005-09-28, 3:24 am |
| On the task in its workflow properties there is a property called "close
connection on completion" Maybe this will help you.
Allan
"Anonymous" <anonymous@email.com> wrote in message
news:m9cjj15c1a8dojb
nbvnj6mdn17mpufoo52@
4ax.com:
> In my scenario, I have a VB.NET class that runs a DTS package. This
> code has worked for years, but under heavy stress I am seemingly
> running out of connections from the connection pool. This leads me to
> believe that the connections being used by the DTS package are not
> being freed up properly after a package has executed.
>
> I know in ADO.NET, you must explicitly Close or Dispose the connection
> in the Finally portion of a Try...Catch block. So, I am trying to
> determine how to do the same thing with a DTS connection and how.
>
> Consider the following abbreviated code:
> -------------------------------------------
>
> Dim objConnection As DTS.Connection2
>
> Try
>
> '...Initialize the package...
>
> 'Create package connection information
> objConnection = objPackage.Connections.New("SQLOLEDB")
> '...Configure the SQL connection...
> objPackage.Connections.Add(objConnection)
> objConnection = Nothing
>
> objConnection =
> objPackage.Connections.New("Microsoft.Jet.OLEDB.4.0")
> '...Configure the Access connection
> objPackage.Connections.Add(objConnection)
> objConnection = Nothing
>
> '...Construct and run the package steps...
>
> Catch ex As Exception
>
> '...Error handling code...
>
> Finally
>
> '...WHAT GOES HERE TO CLOSE THE CONNECTIONS AND PACKAGE?
>
> End Try
|
|
|
|
|