D
Dan Bass
Using:
.Net (happens to be VB but same with C#) 2.0
SQLXML4
SQL Server 2005
I've got a multithreaded .Net application that uses the SQLXmlBulkLoad call
and I'm not convinced the COM object is being released properly. The code is
also called often and I'm not sure if I should be creating the object each
time, or reusing it. I've tried reusing it (one object for all threads with
a lock or one object per thread), but because of the multithreaded nature of
the app, can't get this to work. Each thread is STA...
The Handle count keeps increasing in the application, and eventually it
crashes and I've narrowed it down to the SQL XML Bulk Load bit.
Any help would be appreciated.
The code for this is here:
' load up the SQLXML's bulkload object
Dim bulkLoadComObject As SQLXMLBULKLOADLib.SQLXMLBulkLoad4 = Nothing
Try
bulkLoadComObject = New SQLXMLBULKLOADLib.SQLXMLBulkLoad4
bulkLoadComObject.ConnectionString = _connectionString
bulkLoadComObject.KeepIdentity = False
bulkLoadComObject.Execute(schemaFilename, tempFilename)
Finally
' clear up
If (Not bulkLoadComObject Is Nothing) Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(bulkLoadComObject)
End If
bulkLoadComObject = Nothing
File.Delete(tempFilename)
End Try
.Net (happens to be VB but same with C#) 2.0
SQLXML4
SQL Server 2005
I've got a multithreaded .Net application that uses the SQLXmlBulkLoad call
and I'm not convinced the COM object is being released properly. The code is
also called often and I'm not sure if I should be creating the object each
time, or reusing it. I've tried reusing it (one object for all threads with
a lock or one object per thread), but because of the multithreaded nature of
the app, can't get this to work. Each thread is STA...
The Handle count keeps increasing in the application, and eventually it
crashes and I've narrowed it down to the SQL XML Bulk Load bit.
Any help would be appreciated.
The code for this is here:
' load up the SQLXML's bulkload object
Dim bulkLoadComObject As SQLXMLBULKLOADLib.SQLXMLBulkLoad4 = Nothing
Try
bulkLoadComObject = New SQLXMLBULKLOADLib.SQLXMLBulkLoad4
bulkLoadComObject.ConnectionString = _connectionString
bulkLoadComObject.KeepIdentity = False
bulkLoadComObject.Execute(schemaFilename, tempFilename)
Finally
' clear up
If (Not bulkLoadComObject Is Nothing) Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(bulkLoadComObject)
End If
bulkLoadComObject = Nothing
File.Delete(tempFilename)
End Try