locked
Bi Directional SQL server to SQL server Sync framework using SyncOrchestrator RRS feed

  • Question

  • Hi All,

     

    We need to sync the sql server 2005 to sql server 2005 sync for some tables bidirectional(upload and download) fashion.

    The  table has different primary key column(in both sql DBs) (using SyncOrchestrator). We tried the  upload and download sync seperatly  for some of the tables (with different number of columns and different primary keys in both SQL DB for upload direction). But download is not working. 

    i have done some coding for the bidirectional  initially and  i got error like column missing so i have  done  as below

    provider.ChangesSelected += new EventHandler<DbChangesSelectedEventArgs>(provider_ChangesSelected);

    void provider_ChangesSelected(object sender, DbChangesSelectedEventArgs e)

    {

    if (e.Context.DataSet.Tables.Contains("Project"))

    {

    var dataTable = e.Context.DataSet.Tables["Project"];

    if (!e.Context.DataSet.Tables["Project"].Columns.Contains("Local_Project_id"))

    {

    //let's add the new column

    e.Context.DataSet.Tables["Project"].Columns.Add(new DataColumn("Local_Project_id"));

     

    foreach (DataRow row in e.Context.DataSet.Tables["Project"].Rows)

    {

    // if it's an update or an insert, just assign the clientId

    if (row.RowState == DataRowState.Modified || row.RowState == DataRowState.Added)

    {

    Guid? LocalFindingId = System.Guid.NewGuid();

    row["Local_Project_id"] = LocalFindingId;

    e.Context.DataSet.Tables["Project"].AcceptChanges();

    }

    }

    }

    }

    }

    after we don’t get  any error. but the values  also are not getting downloaded to the client SQL DB.

    Can we try with the  apply changes event  in the other SQL DB for inserting the selected changed row?

    I think the problem is fully in the download part because for the same table upload sync is working fine for the same table.

    Please give me some suggestion to proceed further.

     

     

    Monday, June 13, 2011 9:41 AM

All replies

  • you're calling AcceptChanges which effectively clears out the DataRowState of the rows.

    Remove or comment out that line and try again.

    Monday, June 13, 2011 12:01 PM
  • Hi June.

      Am having one more issue. can we use concurrent user session for the sync operation in SQL. because we are having more than one client they will sync the data in the same time. please let me know the details. this will be really usefull. if this possible means then only we can proceed further.

    Thursday, June 16, 2011 2:28 PM
  • yes, you can run concurrent syncs.

    note that Sync Framework is just like any other database application subject to the same issues around concurrency, locking, etc...

    lookup Tuning and Monitoring Performance in the documentation for some guidance.

    having said that, i suggest you download this hotfix as well: FIX: Non-convergence when DML operations and data synchronization run concurrently in Sync Framework 2.1

    Thursday, June 16, 2011 2:54 PM
  •  Sorry june i forget to say somthing.

    the thing is am looking for concurrent user sync parallelly by having sql Db in server and SQlCE in client  and using

     do this possible. please let me know

     

    ServerSyncProvider : DbServerSyncProvider and

    SyncService: SyncAgent classes in client side

     

    ServerSyncProvider: DbServerSyncProvider classes in server

      

    Thursday, June 16, 2011 3:10 PM
  • am sorry but i dont get what you're after. can you elaborate further?

    Thursday, June 16, 2011 3:21 PM
  • Hi June,

    in my appliation am doing download,snapshot,bidiretional sync between sql 2005 and sqlce DB for various tables as per our requirement. currently am facing issue when multiple user sync at same time. but its run with out any issue when user connect one by one. i want to know will sync framework supports multiple user sync at same time.

    Friday, June 17, 2011 1:28 AM
  • as i have mentioned, Sync Framework is just like any other database application. you should be able to have multiple users sync at the same time.

    what issue are you having with multiple users synching

    Friday, June 17, 2011 4:36 AM
  • Hi June,

    This is  what the error we got while two of us sync at the same time.

    Error:

    Table name 'Company' is not valid. This might be caused by one or more of the following issues: unable to find a SyncAdapter for the specified SyncTable; the table name is null or empty; or the table name contains the keywords SET, FMTONLY, and OFF.

     

    but we are not getting error while sync  at different time.

    please help me out in this.

     

     


    Friday, June 17, 2011 9:16 AM
  • i suggest you enable sync framework tracing to get some more details. just by looking at the error, i dont think it has something to do with concurrency but i may be wrong.
    Friday, June 17, 2011 9:26 AM
  • ok june i will  try to log the bug and let u know ASP.
    Friday, June 17, 2011 4:05 PM