Solved

COM+ Component Transaction Isolation Level

Posted on 2010-11-10
4
863 Views
Last Modified: 2012-05-10
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
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

Open in new window

0
Comment
Question by:jasonabarnett
  • 3
4 Comments
 
LVL 8

Accepted Solution

by:
GundogTrainer earned 500 total points
ID: 34103722
is COMAdminTxIsolationLevelReadCommitted  a standard constant ?
have you tried setting it ti its value first

COMAdminTxIsolationLevelReadCommitted = 2
0
 

Author Comment

by:jasonabarnett
ID: 34104342
Hi GundogTrainer,

Thank you for your response.

Having kicked myself for not considering this I've updated line fifteen as follows:

oComponent.Value("TXIsolationLevel") = 2

Rather than define a constant I've explicitly defined the value.  I now get the following error:

set_component_isolation.vbs(15, 4) Microsoft VBScript runtime error: Invalid procedure call or argument

I suspect we are close but I can't see the wood for the trees here, any further advice please?

Regards,

Jason
0
 

Author Comment

by:jasonabarnett
ID: 34105134
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
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

Open in new window

0
 

Author Closing Comment

by:jasonabarnett
ID: 34105149
Not a complete answer but put me on the road to the ultimate solution.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question