Re: Web Suscription of a SQL Server 2005 CE client to a SS 2005 Standa

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



You don't need the ,1433 for your distributoraddress parameter. Also
add your PublisherNetwork and PublisherAddress parameters.

Feel free to contact me offline for more assistance.

Here is a code sample that worked for me.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Replication;
using Microsoft.SqlServer.Server;
using Microsoft.SqlServer.Management.Common;

namespace Corey
{
class Program
{
static void Main(string[] args)
{

string
subscriberName = ".";
string publisherName = "144760-WEB2";
string publicationName = "RRDataSync";
string subscriptionDbName = "RRData";
string publicationDbName = "RRData";
ServerConnection conn = new
ServerConnection(subscriberName, "sa", "nsbhy+Cevf");
MergePullSubscription sub;
MergeSynchronizationAgent agent;
try
{
conn.Connect();
sub =
new MergePullSubscription();
sub.ConnectionContext = conn;
sub.DatabaseName = subscriptionDbName;
sub.PublisherName = publisherName;
sub.PublicationDBName = publicationDbName;
sub.PublicationName = publicationName;
if (sub.LoadProperties())
{
agent = sub.SynchronizationAgent;
agent.PublisherSecurityMode =
SecurityMode.Standard;
agent.PublisherAddress =
"111.111.111.111";
agent.PublisherNetwork =
NetworkType.TcpIPSockets;
agent.PublisherLogin =
"sa";
agent.FileTransferType = FileTransferOption.Ftp;
agent.PublisherPassword =
"publisherPasswrd";
agent.DistributorSecurityMode =
SecurityMode.Standard;
agent.Distributor = publisherName;
agent.DistributorAddress =
"111.111.111.111";
agent.DistributorNetwork =
NetworkType.TcpIPSockets;
agent.DistributorLogin =
"sa";
agent.DistributorPassword =
"distributorPassword";
//agent.HostName = "";
agent.UseWebSynchronization =
true;
agent.InternetUrl =
"https://www.DomainName.com/RRDataWebSync/
replisapi.dll";
agent.InternetSecurityMode =
SecurityMode.Standard;
agent.InternetLogin =
"internetlogin";
agent.InternetPassword =
"internetpassword";
agent.SubscriptionType =
SubscriptionOption.Anonymous;
agent.SubscriberDatabase =
"RRData";
agent.SubscriberLogin =
"sa";
agent.SubscriberPassword =
"password";
agent.SubscriberSecurityMode =
SecurityMode.Standard;
agent.OutputVerboseLevel = 1;
agent.Output =
"";
agent.Synchronize();
}
else
{
throw new ApplicationException(String.Format("A
subscription to '{0}' does not exist on {1}", publicationName,
subscriberName));
}
}
catch (Exception ex)
{
throw new ApplicationException("The subscription could
not be synchronized. Verify that the subscription has been defined
correctly.", ex);
}
finally
{
conn.Disconnect();
}
}
}
}


On Jan 8, 9:49 am, Cetel Sistemas
<CetelSiste...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Hello:

Production environment configuration:
1 Server running SQL Server 2005 containing the publications. This is the
publisher (name : PUB)
1 Server running SLQ Server 2005 containing suscriptions. This is the
Distributor (name : DIST)
1 Server running IIS (Windows server 2003) (name : FRONTAL)

These replications are transactional and they are working ok

I have create a merge replication called TPVOFF00003 in the server PUB and I
have configure web sync. in the server FRONTAL. In a web browser the Urlhttp://PUBLIC_IP_FRONTAL/TPVOFF00003/sqlcesa30.dll?diagis responding ok.

I have a VB6 program to sync. a local SQL Server CE 2005 (a sdf file) with
the publication TPVOFF00003. I am using native objects of SSCE Replication.
In my Pre-Production environment, the publihser and the distributor are on
the same server and instance of SQL Server 2005. Under these conditions, the
sync. of the sdf file with the pre-production merge replication runs ok, but
in production it does not be able to sync. I think that the problem is the
fact that the publisher and the dsitributor are in different servers, but i
am not be able to obtain an error description. I am trying to configure the
distributor properties of the client sync but i always obtain an error.

Sorry about a too large explanation.

Please, can anybody help me with this issue?

Here is the code

Dim repl As SSCE.Replication

Set repl = CreateObject("SSCE.Replication.3.0")
'HERE I AM TRYING TO CONFIGURE DISTRIBUTOR PROPERTIES
'repl.Distributor = "DIST"
'repl.DistributorLogin = "sa"
'repl.DistributorPassword = "DISTsaPassword"
'repl.DistributorSecurityMode = DB_AUTHENTICATION
'repl.DistributorNetwork = TCPIP_SOCKETS
'repl.DistributorAddress = "LocalIPOfDIST,1433"

repl.InternetURL = "http://PUBLIC_IP_FRONTAL/TPVOFF00003/sqlcesa30.dll";
repl.Publisher = "PUB"
repl.PublisherDatabase = "database_name"
repl.PublisherSecurityMode = DB_AUTHENTICATION
repl.PublisherLogin = "sa"
repl.PublisherPassword = "PUBsaPassword"
repl.Publication = "TPVOFF00003"
repl.Subscriber = "SUS_TPVOFF00003"
repl.SubscriberConnectionString = "Data Source=C:\folder\file.sdf"
'On Error Resume Next
If Not Existe("C:\folder\file.sdf") Then
repl.AddSubscription (CREATE_DATABASE)
End If
repl.Initialize
On Error Resume Next
repl.Run
If repl.ErrorRecords.Count > 0 Then
'An error happens but this function does not show anything
ShowErrors repl.ErrorRecords
End If

repl.Terminate

Set repl = Nothing

Sub ShowErrors(ErrColl As SSCEErrors)

'Initailize error variables to view error collection
Dim ErrRec As Object 'SSCE.ErrorRecords
Dim Paramet As SSCEParam
Dim strErr As String

strErr = ""
For Each ErrRec In ErrColl
strErr = strErr & "Source: " & ErrRec.Source & vbCrLf
strErr = strErr & "Number: " & Hex(ErrRec.Number) & vbCrLf
strErr = strErr & "NativeError: " & ErrRec.NativeError & vbCrLf
strErr = strErr & "Description: " & ErrRec.Description & vbCrLf
For Each Paramet In ErrRec.Params
strErr = strErr & "Param" & " = " & Paramet.param & vbCrLf
Next Paramet
strErr = strErr & vbCrLf
Next ErrRec

MsgBox strErr, vbOKOnly

End Sub

.



Relevant Pages

  • Re: Change distribution server
    ... I now have the distributor and subscriber setup on SQL2005. ... SQL2005 SQL Agent is started under Local System Account if that matters. ... To get the SQL 2000 server to use the SQL 2005 distributor, ... subscriptions before doing this because the warning message seems pretty ...
    (microsoft.public.sqlserver.replication)
  • Re: Compromise of the nobody account?
    ... Find a real news server. ... or unknown security hole. ... If the distributor hasn't set that configuration by ... Linux are likely to be more competent than typical Windows users, ...
    (comp.security.unix)
  • Re: Inactive Publisher??????
    ... MSdistpublishers table in msdb on the distributor server shows the ... Shouldn't the publisher server have is_publisher=1? ... I then imported data from the publisher to the subscriber so that the ...
    (microsoft.public.sqlserver.replication)
  • Re: Remote Dist - Snpsht / Trans Replication Fails to Create
    ... Has anyone created any previous publications on the publisher or ... Issue the Select @@servername query on the publisher and distributor. ... >> Looking for a SQL Server replication book? ...
    (microsoft.public.sqlserver.replication)
  • Re: Web Synchronization for Merge Replication
    ... Looking for a SQL Server replication book? ... External Firewall between Client A and DMZ IIS Server A has only ports 80 ... subscription from the Publishcation on Server B as shown below: ... subscription.PublisherName = publisherName; ...
    (microsoft.public.sqlserver.replication)