HOWTO: Implement Nested Transactions with OracleID: Q187289
|
ADO and ODBC do not support nested transactions. However, native Oracle SQL supports the SAVEPOINT keyword that can be used to simulate nested transactions.
The Microsoft Knowledge Base article Q177138, entitled "INFO: Nested
Transactions Not Available in ODBC/OLE DB/ADO" says this about nested
transactions:
"Neither Open Database Connectivity (ODBC, nor any released Microsoft OLE DB Provider supports Nested Transactions. ActiveX Data Objects (ADO) supports the feature, but only if the underlying provider exposes it. Currently none of Microsoft's OLE DB providers support Nested Transactions."
Conn = "UID=****;PWD=****;DRIVER={Microsoft ODBC for Oracle};" _
& "SERVER=SamOracle;"
Set Cn = New ADODB.Connection
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
Cn.BeginTrans
Cn.Execute "SAVEPOINT ALPHA"
Cn.Execute "INSERT INTO trantest VALUES(1,10)"
Cn.Execute "INSERT INTO trantest VALUES(2,10)"
Cn.Execute "SAVEPOINT BETA"
Cn.Execute "INSERT INTO trantest VALUES(3,10)"
Cn.Execute "INSERT INTO trantest VALUES(4,10)"
Cn.Execute "ROLLBACK TO SAVEPOINT BETA"
Cn.Execute "COMMIT"
Cn.RollbackTrans
For information on how to acquire the Microsoft Data Access Components
(MDAC) stack (which includes the Microsoft ODBC for Oracle driver), please
see the following Microsoft Knowledge Base article:
Q175018 : HOWTO: Acquire and Install the Microsoft Oracle ODBC Driver
Q177138 : INFO: Nested Transactions Not Available in ODBC/OLE DB/ADO
Q176936 : INFO: Visual Basic 5.0 Accessing an Oracle Database Using ADO
Additional query words: kbADO150 kbOracle200 kbDSupport kbdse kbVBp500 kbVBp600 kbOracle kbODBC kbDriver kbDatabase kbADO
Keywords :
Version : WINDOWS:1.5,2.0,2.5,5.0,6.0
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: June 3, 1999