Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advice for transfering XML using COM+

Status
Not open for further replies.

catab

Programmer
Mar 19, 2003
5
RO
Hi! I have one server running W2K Server & SQL Server & COM+. I want to write a small application using VB. The client interface collect some data from the client, and i want to write those informations in a SQL Database, using XML (to make only one call to SQL Server). I created the stored procedure that have a parameter which is the XML String. The XML string is something like that:
<root>
<message>Call Michael</message>
....... (let's say that there are 5 elements
</root>

I have 2 options for implemeneting the client:
1. The client call 5 times a method of the COM+ class, the class create the XML document and pass it to the stored procedure
2. The client create the XML document, pass the document as a parameter of the method, and the class pass it to the stored procedure.

Which option is faster or recommended?

Thanks! Have a nice day!
 
where ever possible always only call a COM object 1 time to do a job. Making successive calls implies stateful object and is generally speaking a bad idea
 
SemperFiDownUnda is correct on calling a COM+ component as few times as possible is more efficient. However, making multiple calls to a component in itself does not make it stateful. Stateful is when you store the data in a class level variable in one call and expect it to still be there in the next call.

The reason calling a COM+ component multiple times is less efficient is because the data must be marshalled between the client process and the component's process since they do not share the same memory space. If the component lives on the same computer as the client process, it probably isn't the call to the COM+ component that will be the biggest performance issue, it would be the 5 round trips to the SQL Server. In addition to making a single call to the COM+ component, making a single call to the SQL server would improve the performance as well.

Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top