Quantcast
Channel: SQL Server Replication forum
Viewing all articles
Browse latest Browse all 4054

Error 1326: The schema script 'TableName_2.sch' could not be propagated to the subscriber (from C#)

$
0
0

Hi all, I'm new in Merge Replication and I don't know how to solve my problem.

I have 2 computer:

  1. PC1: Distribution and publication server (Windows Server 2008R2)
  2. PC2: Subscriber (Windows 7)

I have 1 database on PC1: DB_NAME 

I defined these accounts:

  1. PC1: SQL account PC1_AC1 (account for distribution and publication), Windows Account PC1_AC2 (account for snapshot agent)
  2. PC2: Windows Account PC2_AC1.

I set the following rights:

  1. PC1_AC1: db_owner of distribution database, db_owner of database DB_NAME, Roles: public, serveradmin 
  2. PC1_AC2:db_owner of distribution database, db_owner of database DB_NAME, granted access of the "repldata" folder (read/write). Role: public, sysadmin

I set the distribution server and created a publication correctly. On PC2, from code, I created a subscriber and when I try to synchronize the subscriber database with the publisher I have this error:

"The schema script 'TableName_2.sch' could not be propagated to the subscriber. OS error 1326 username or password not valid."

I don't understand where is the problem because from windows I can reach the snapshot folder "\\<server_name>\repldata\unc\" with PC1_AC2 account but apparently not from code. I'm executing this code:

MergeSynchronizationAgent syncAgent;
MergePullSubscription mergePullSub = new MergePullSubscription();

mergePullSub.ConnectionContext = <connection_name>;
mergePullSub.PublicationName = <publication_name>;
mergePullSub.PublisherName = <publicher_name>;
mergePullSub.PublicationDBName = DB_NAME;
mergePullSub.DatabaseName = DB_NAME_SUB;

mergePullSub.LoadProperties();

mergePullSub.AltSnapshotFolder = "\\<server_name>\repldata";

mergePullSub.SynchronizationAgent.DistributorSecurityMode = SecurityMode.Standard;
mergePullSub.SynchronizationAgent.DistributorLogin = PC1_AC1_login;
mergePullSub.SynchronizationAgent.DistributorPassword = PC1_AC1_password;

mergePullSub.SynchronizationAgent.PublisherSecurityMode = SecurityMode.Standard;
mergePullSub.SynchronizationAgent.PublisherLogin = PC1_AC1_login;
mergePullSub.SynchronizationAgent.PublisherPassword = PC1_AC1_password;

mergePullSub.SubscriberSecurity.WindowsAuthentication = true;

syncAgent = mergePullSub.SynchronizationAgent;
syncAgent.ExchangeType = MergeExchangeType.Bidirectional; 

// Start the Merge Agent Job.
try
{
     syncAgent.Synchronize();
}
catch (Exception)
{

}

Can someone help me? Wher is the error?

Thank you very much



Viewing all articles
Browse latest Browse all 4054

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>