Friday, February 17, 2012

Compatiblity of SQLDMO and SQLSMO with respect to scripting via COM

Hi all,

I need your help:

Context:
I have developed since long an installation with InstallShield's InstallScript language. This installation "talks" to SQLServer2000 in order to install, upgrade, backup and restore the application's database. All this is done in the InstallScript code using SQLDMO currently, using the COM interface as if using VB script.

Problem:
Now as we are preparing to support installation on SQL2005, I am investigating the usage of SQLSMO, as SQLDMO cannot be excepted on all target systems (SQLExpress must be supported, too).

I looked in the SMO namespace and recognized, that the contained classes are registered as COM objects, too. Due to this I have no problem creating a Microsoft.SqlServer.Management.Smo.Server object from my scripting code.
But - opposed to SQLDMO the SMO server object does not have a Connect() method.

Looking further I found the Microsoft.SqlServer.Management.Common.ServerConnection object which seems to have the functionality I need - but this object is not registered as a COM object and as such is not scriptable - I am stuck :-(

Generally it seems, that SQLSMO is by far not a replacement or enhancement to SQLDMO. So - how to solve tasks which where using SQLDMO up to now?

Please - give advice!

Thanks,
Jo

Sorry, Jo, you're correct with respect to COM support for SMO - it's not there. It's not hard to build a VB console application to do what you're attempting, though, and then you can connect to the server either through the Connect() method or by setting arguments in the ServerConnection object. I've used both successfully.

There's a lot of argument in this forum whether or not SMO is an enhancement to DMO, and while some have had some performance issues with SMO, I feel that the object model is much more straightforward and easy to use than its predecessor. We just have to approach things differently.

No comments:

Post a Comment