Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-02-04 : 20:02:17
|
Sam writes "I have 1 Windows 2000 Server running SQL 2000 Enterprise Server (SRV1) and 2 Windows 2000 Pro PCs (PC1 & PC2); PC1 has SQL2000 Developer and PC2 has SQL2000 Personal. PC1 also has Visual Studio. The SQL Server is configured as a Distributor and a Publisher. I’ve a database with a merge publication defined for it that should allow PC1 & PC2 to subscribe to the publication. I’ve developed a VB project that utilizes the SQLObject. Here is the code copied from Microsoft MSDN documentation.
Private Sub Command1_Click() Set sm = New SQLMerge Dim ErrorObject Dim SaveMousePointer As Integer Dim txtUserID, txtPswd As String Dim strDate As String On Error Resume Next 'Setup publisher With sm ' set up the Publisher .Publisher = SRV1 .PublisherAddress = SRV1.local .PublisherNetwork = TCPIP_SOCKETS .PublisherDatabase = MyDB .Publication = MergeMyDB .PublisherSecurityMode = DB_AUTHENTICATION .PublisherLogin = "sa" .PublisherPassword = “” ' set up FTP .FileTransferType = FILETRANSFERFTP ' set up the Distributor .Distributor = SRV1 .DistributorAddress = SRV1.local .DistributorNetwork = TCPIP_SOCKETS .DistributorSecurityMode = DB_AUTHENTICATION .DistributorLogin = sa .DistributorPassword = “” ' set up the Subscriber .Subscriber = Environ("COMPUTERNAME") .SubscriberDatabase = MyDBLocal .SubscriberDatasourceType = SQL_SERVER .SubscriberSecurityMode = NT_AUTHENTICATION ' set up the Subscription .SubscriptionType = ANONYMOUS .SynchronizationType = AUTOMATIC End With On Error GoTo Failure Dim replerr As SQLReplError ProgressBar.Value = 0 Label4.Caption = "Starting Merge" Label4.Refresh
SaveMousePointer = MousePointer MousePointer = 11 sm.Initialize sm.Run sm.Terminate Command1_Exit: ProgressBar.Value = 0 MousePointer = SaveMousePointer Exit Sub Failure: For Each replerr In sm.ErrorRecords MsgBox replerr.Description, vbCritical, "SQL Replication Failure" Next replerr Label4.Caption = "" ProgressBar.Value = 0 Resume Command1_Exit End Sub
When I run my application on PC1, replication runs correctly. It will initialize the database from the snapshot and update any changes made at either site to the corresponding server. Prior to running I create MyDBLocal on PC1 or PC2.
I’ve packaged the VB application and deployed it to PC2.
When I run the application on PC2 I get the following messages from the SQLMerge object: * Initilizing * Connecting to Publisher SQL1. * Retrieving publication information. * Retrieving subscription information. * The subscription has been marked for reinitialization. Reinitialization will occur the next time you synchronize this subscription. * The schema script ‘’ could not be propagated to the subscriber. *Could not apply snapshot via ftp because the Publication was not enabled for internet.
My initial response was to verify that PC2 had access to the database and to the publication. In the ‘Publisher and Distributor Properties’ on SRV1 I checked the Publishers tab and verified that only SRV1 was enabled as a Publisher. On the Publication Databases tab, MyDB is checked for a merge replication. On the Subscribers tab, PC1 & PC2 were checked and the Subscriber Security Properties for each is to ‘Use SQL Server Authentication’, with Login sa and Password “”; the schedules are the same, also. The Publication Access List in the Publication grants login 'sa' access privileges |
|
|
|
|
|