December 18, 2002 at 10:10 am
I try to use app object and read the
available server group at servergroups collection. I can get the result that i wanted when running my program on the same machine (with SQL2000 standard edition) but no any server groups can be detected when running on another machine (the same program that i created).
Even i use the sample program "Explore" provided by microsoft at SQL 2000 installation CD, this sample program also not able to show the server groups that i had when running on difference machine ( the machine that without SQL Server)
Plase help. Thanks
December 18, 2002 at 1:56 pm
I dont think you can get the info from another machine. Not sure why it would make sense to do so anyway? If you want the list of available servers there is a different method for that.
For those not familiar, here is how you'd retrieve the info in VB after setting a reference to the SQLDMO library:
Dim oApp As SQLDMO.Application
Dim oServerGroup As SQLDMO.ServerGroup
Dim oRegServer As SQLDMO.RegisteredServer
Set oApp = New SQLDMO.Application
For Each oServerGroup In oApp.ServerGroups
Debug.Print oServerGroup.Name
For Each oRegServer In oServerGroup.RegisteredServers
Debug.Print "---"; oRegServer.Name
Next
Next
Set oApp = Nothing
Andy
December 18, 2002 at 10:26 pm
Thanks to Andy Warren for the reply.
The VB code given is almost the same as what i did but with a SQLServer object to make the connection to my SQL server.
When i trace the code, oApp.ServerGroups.Count is = 0, but on my SQL Server having three difference server groups. The funny thing is when running the code as below on the same machine with SQL Server then oApp.ServerGroups.Count = 3, it is collect, when run the code below on difference machine ,the count become 0 already.
The reason that why i need it is i need to determine whether or not that server group is existed, if not then i need to create one and register local SQL server to this group during my application installation procees.
After that i need to create a PUSH SUBSCRIBTION and store the subscribtion database into this local SQL Server. Since the local SQL Server is SQL desktop engine, so if i register it into the MAIN SQL Server where admin can use GUI to monitor all the registered desktop engine and the publication/subscribtion process readily earier.
Please guide me for your expert advices
Thanks
December 19, 2002 at 4:36 am
Server Groups are logical orderings you create in EM. They are stored in the registry. ServerGroups reads only from the local machines registry where the application is run. So on the local machine you get 0 becasue none are defined (most likely no client tools installed or EM don't remember the full requirements). But when run from the server you get 3 (they exist in that machines registry). For you to get them you have a couple of options you could explore.
1) Create a DCOM object to allow remote access (I hate DCOM personally, 3 bad experiences based on another developers code).
2) Create an Extended Stored Procedure. The template is in Visual C++ and I have not seen it done VB (don't think you can). But you create a XP dll to install on the server then you make a connection and call the XP to get the information.
3) Do remote registry reads. Not a good option though as you open registry and server to malicious attacks.
December 19, 2002 at 4:52 am
Agree with Antares (or was he agreeing with me?). Makes sense to write the app as if it runs local, if you need to just wipe out/change the reg servers on your test machine for now. Need to look at the security requirements for push subscriptions.
Andy
December 19, 2002 at 7:58 am
Thanks to Antares686 and again Andy Warren
i've thought an approach, i can create a SP with required params on the MAIN sql server which can be called from all my client program during the installation.
From the SP which will call a XP.dll (it can determine the exsiting server group as well as register deskstop engine server.
Is it a bit better ??
Thanks
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply