locked
Unable to initialize Client Database Error RRS feed

  • Question

  • I am using the local database cache to synchronize SQL Server 2008 with a SQL Server Compact Database in a windows form application. I have it set to download the entire table each time and the create option is set to DropExisitingOrCreateNewTable. The sync works about 2 out of 3 times but when it fails I receive the following error. Does anyone have any ideas on why or how to fix it.

    Unable to initialize the client database, because the schema for table 'tblProfitScan' could not be retrieved by the GetSchema() method of DbServerSyncProvider. Make sure that you can establish a connection to the client database and that either the SelectIncrementalInsertsCommand property or the SelectIncrementalUpdatesCommand property of the SyncAdapter is specified correctly.

       at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetSchema(Collection`1 tableNames, SyncSession syncSession)
       at Microsoft.Synchronization.SyncAgent.InitClientSchema()
       at Microsoft.Synchronization.SyncAgent.DataSynchronize()
       at Microsoft.Synchronization.SyncAgent.Synchronize()
       at ProfitScan.Form1.bgwUpdateProductList_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\sdavis\Desktop\ProfitScan\ProfitScan\Form1.cs:line 452
       at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
       at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

    Wednesday, March 21, 2012 7:14 PM

All replies

  • the schema is retrieved by querying the server, could it be that your app is unable to connect or is disconnected from your server when you get the error?

    try enabling sync framework tracing to get more information.

    Thursday, April 5, 2012 10:34 AM
  • Seeing a similar problem. I see that as the data in the table grows on the server, GetSchema takes more and more time. Finally when it starts taking around 30 seconds, it throws the above error. (A timeout error would have been much better though)

    Is it that GetSchema is dependent on the number of rows? If so why?

    Is there some setting which will make it not dependent on the number of rows??

    Thanks,
    Lokesh

    Monday, June 11, 2012 9:10 AM
  • its not dependent on number of rows. to get the table schemas, the server provider will run the selectincremental command but ignore the actual rows, it just needs the schema.

    if you dont want it to run the commands, you can populate the schema yourself.

    search DbServerSyncProvider.Schema in the documentation and you should find a sample how to populate the schema manually.

    Monday, June 11, 2012 10:16 AM