Re: Web Suscription of a SQL Server 2005 CE client to a SS 2005 Standa
- From: Hilary Cotter <hilary.cotter@xxxxxxxxx>
- Date: Wed, 9 Jan 2008 11:36:31 -0800 (PST)
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
.
- References:
- Web Suscription of a SQL Server 2005 CE client to a SS 2005 Standa
- From: Cetel Sistemas
- Web Suscription of a SQL Server 2005 CE client to a SS 2005 Standa
- Prev by Date: Re: Fault tolerant distributor in merge replication and data mirroring (in SQL Server 2005/2008)
- Next by Date: Re: Replication solution?
- Previous by thread: Web Suscription of a SQL Server 2005 CE client to a SS 2005 Standa
- Next by thread: Fault tolerant distributor in merge replication and data mirroring (in SQL Server 2005/2008)
- Index(es):
Relevant Pages
|