SQL Server Q&A

As a software engineer, I focus on .NET, especially asp.net, C#, WCF and so on, and I am also very interested in Search Engine Optimization.

Entries Tagged ‘COM’

FIX: An exception occurs when you try to perform a one-phase commit on an XA-enabled JDBC connection in SQL Server 2005

Symptoms
When you try to perform a one-phase commit on an XA-, or two phase-, enabled JDBC connection in Microsoft SQL Server 2005, the following exception occurs:

Exception in thread “main” com.microsoft.sqlserver.jdbc.SQLServerException: The COMMIT TRANSACTION request has no corresponding BEGIN TRANSACTION.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.IOBuffer.processPackets(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectionCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendCommit(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.commit(Unknown Source)
Resolution
This problem occurs because SQL Server 2005 does not allow a one-phase commit on a two-phase-enabled data source.

InterOp interfaces must match Vtable layout for early binding to work

Symptoms
When you call a COM method through InterOp, you may receive the following error message:

An unhandled exception of type System.Exception occurred in ApplicationName.exe
Additional information: Object reference not set to an instance of an object.
Resolution
This problem may occur when the order of the methods declaration in the InterOp interface does not match the order of the Vtable layout of the COM interface (which is determined by their layout in IDL). Because you perform early binding in most cases, the order of the methods is very important in this scenario.

BUG: Unexpected exception when you perform a late bind to call a Component Object Model component that returns a structure

Symptoms
In a Microsoft .NET Framework application, when you perform a late bind to call a Component Object Model (COM) component that returns a structure, you may receive the following exception when you run the application:

An unhandled exception of type ‘System.ArgumentException’ occurred in Mscorlib.dll
Additional information: The method returned a VT_RECORD Variant, which is not supported by Interop.
Resolution
To work around this bug, perform an early bind instead of a late bind while you call the COM component.