I have created a COM component that does basic ADO activities like Opening a
connection, Closing a connection, Begining a transaction, Commiting a
transaction, Executing a query, Executing a stored procedure.
Now i have to test the component using CPP UNIT test tool.
I use CPPUNIT_ASSERT to compare the exceptions thrown.
The following is the code
//Test case: Close the connection before commiting or aborting the transaction
void FailureTestCases::TestCaseE1()
{
//Call the OpenConnection method
//Call BeginTransaction first time
//Call the CloseConnection method
CPPUNIT_ASSERT( 0x800A0CAE == objDBComponent->CloseConnection());
}
The call to the CloseConnection method returns an error 0x800A0CAE which means
"Connection object cannot be explicitly closed while in a transaction."
when comparing using CPPUNIT_ASSERT, i want the comparison to be done using
the corresponding constant value (adErrInTransaction ) and not the
Hexadecimal equivalent.
but if i try to do it the assertion fails. how do i handle this.
MSDN gives the following details:
adErrInTransaction
3246
-2146825042
0x800A0CAE
Connection object cannot be explicitly closed while in a transaction.
adErrInTransaction - is an ErrorValueEnum in msado15.dll
.
Re: Working Transactions somehow started not to work ...Transaction and locking are not properties of recordsets but are properties ... Opening a served-based cursor will put a lock on ... If a connection is closed, ... SL> and are not associated necessarily with server-based cursors.... (microsoft.public.access.adp.sqlserver)
TransactionScope Transactions not commiting ... be) using the same SQL Connection.... and dtermines the Connection String to use to create the connection to ...MyClass obj = new MyClass; ... not involved in a Transaction.... (microsoft.public.dotnet.framework.adonet)
Re: Driver AutoCommit issue ... Isn't the XA driver for the distributed transaction, I need to install the path sqljdbc_xa.dll and xa_install.sql before using the XA driver. ... I created a TX aware datasource using com.microsoft.sqlserver.jdbc.SQLServerDriver and tried to get the connection from the TX aware data source. ... I set the auto commit to false on connection as soon as I get the connection from the datasoruce. ... (microsoft.public.sqlserver.jdbcdriver)
Re: Oracle distributed transaction ... > Connections are drawn from the pool and assigned based on transaction... The context of the requesting thread and the assigned connection> must match. ... Therefore, each connection pool is actually subdivided into> connections with no transaction context associated with them, and into N> subdivisions that each contain connections with a particular transaction> context. ... This allows you to commit or abort the> distributed transaction at a later time. ... (microsoft.public.dotnet.framework.adonet)