jasonabarnett
asked on
COM+ Component Transaction Isolation Level
Dear Experts,
I have a number of VBScripts to manage the COM+ components in an application upgrade. I have a script to add new components from a folder of DLL's. The final piece of my install is to set the TXIsolationLevel of the components.
Please see the attached. If anyone can get this snippet of code to work I'll be over the moon.
The WScript.Arguments.Item(0) is passed in from the command line as the name of my COM+ application. The iteration through the components works however the syntax for setting the isolation level isn't right.
Many thanks in advance,
Jason
I have a number of VBScripts to manage the COM+ components in an application upgrade. I have a script to add new components from a folder of DLL's. The final piece of my install is to set the TXIsolationLevel of the components.
Please see the attached. If anyone can get this snippet of code to work I'll be over the moon.
The WScript.Arguments.Item(0) is passed in from the command line as the name of my COM+ application. The iteration through the components works however the syntax for setting the isolation level isn't right.
Many thanks in advance,
Jason
Dim oCatalog, oApplications, oApp, oComps, oComponent, i
Set oCatalog = CreateObject("ComAdmin.COMAdminCatalog")
Set oApplications = oCatalog.GetCollection("Applications")
oApplications.Populate
For Each oApp In oApplications
If oApp.Name = WScript.Arguments.Item(0) Then
Set oComps = oApplications.GetCollection("Components", oApp.value("ID"))
oComps.Populate
For i = oComps.Count -1 To 0 Step -1
Set oComponent = oComps.Item(i)
oComponent.Value("TXIsolationLevel") = COMAdminTxIsolationLevelReadCommitted
Next
oComps.SaveChanges
End If
Next
oApplications.SaveChanges
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Hi,
Building on your answer and a bit of trial and error I've resolved the issue. TxIsolationLevel is case sensitive so my TXIsolationLevel wasn't recognised.
Working code attached for the good of humankind :).
Points to GundogTrainer for steering me in the right direction.
Regards,
Jason
Building on your answer and a bit of trial and error I've resolved the issue. TxIsolationLevel is case sensitive so my TXIsolationLevel wasn't recognised.
Working code attached for the good of humankind :).
Points to GundogTrainer for steering me in the right direction.
Regards,
Jason
Option Explicit
Dim oCatalog, oApplications, oApp, oComps, oComponent, i
Set oCatalog = CreateObject("ComAdmin.COMAdminCatalog")
Set oApplications = oCatalog.GetCollection("Applications")
oApplications.Populate
For Each oApp In oApplications
If oApp.Name = WScript.Arguments.Item(0) Then
Set oComps = oApplications.GetCollection("Components", oApp.value("ID"))
oComps.Populate
For i = oComps.Count -1 To 0 Step -1
Set oComponent = oComps.Item(i)
oComponent.Value("TxIsolationLevel") = 2
Next
oComps.SaveChanges
End If
Next
oApplications.SaveChanges
ASKER
Not a complete answer but put me on the road to the ultimate solution.
ASKER
Thank you for your response.
Having kicked myself for not considering this I've updated line fifteen as follows:
oComponent.Value("TXIsolat
Rather than define a constant I've explicitly defined the value. I now get the following error:
set_component_isolation.vb
I suspect we are close but I can't see the wood for the trees here, any further advice please?
Regards,
Jason