Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Answered SqlCE to Sql Server provisioning error

  • Wednesday, February 29, 2012 7:49 PM
     
      Has Code

    For some reason I am getting this error and am hoping someone can suggest what I am doing wrong:

    Error: The current operation could not be completed because the database is not provisioned for sync or you not hav
    e permissions to the sync configuration tables.

    This is coming from when I am trying to sync to a sqlce file. If I sync to to sql servers end to end I am fine. I am sure I am missing a critical provisioning step when preparing a sqlce file. Here is the code I am using to set the sqlce file up (thanks for your help):

            

    publicSqlCeSyncProvider ConfigureSqlCeSyncProvider()         {             SqlCeConnection ceConn = newSqlCeConnection("Data Source=\"" + Path.GetFullPath(this.currentPlugin.ProfileSettings.Properties.SqlCEFile) + "\"");             SqlCeSyncProvider provider = newSqlCeSyncProvider(this.currentPlugin.ProfileSettings.Properties.PeerScopeName, ceConn);             provider.ObjectPrefix = "CESync";             SqlCeSyncScopeProvisioning ceConfig = newSqlCeSyncScopeProvisioning(ceConn);             if (!ceConfig.ScopeExists(this.currentPlugin.ProfileSettings.Properties.PeerScopeName))             {

    // calls custom process that gets the database information

    this.currentPlugin.PreProvisionProcess();                 DbSyncScopeDescription scopeDescription = newDbSyncScopeDescription();                 scopeDescription = this.currentPlugin.GetScopeDescription(null, scopeDescription);                 scopeDescription.ScopeName = this.currentPlugin.ProfileSettings.Properties.PeerScopeName;                 ceConfig.PopulateFromScopeDescription(scopeDescription);                 ceConfig.Apply();             }             return provider;         }

                         

All Replies

  • Wednesday, February 29, 2012 9:28 PM
    Moderator
     
     
    have you checked that your app is pointing to the same SDF file?  you might want to put a breakpoint to check if the path for the SDF being provisioned is the same path the sync is pointing to.
  • Thursday, March 01, 2012 1:08 PM
     
     
    I double checked this. And it is pointing to the same file, they have the same path. I double checked the contents of the sdf file and the server and they are both being provisioned. The sdf file is being populated with the sync tables etc. But then I still get the error. I think you are on the right track though. Something must be pointing at something wrong. Any other ideas? Could the sdf file be locked somehow some place? I am at such a loss. Thanks for your help.
  • Thursday, March 01, 2012 1:22 PM
     
     

    Here is the main head of the stack trace:

    Error: The current operation could not be completed because the database is not provisioned for sync or you not hav
    e permissions to the sync configuration tables.
       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeManagementUtils.VerifyRuntimeAndSchemaVersionsMatch(SqlCeConn
    ection connection, SqlCeTransaction trans, String objectPrefix, Boolean autoUpgrade, Boolean throwWhenNotProvisione
    d)
       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncUtil.OpenConnectionAndCheckVersion(SqlCeConnection connec
    tion, String objectPrefix, Boolean expectProvisioning)
       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncProvider.Connect()
       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncProvider.InitializeAdapters()
       at Microsoft.Synchronization.Data.SqlServerCe.SqlCeSyncProvider.BeginSession(SyncProviderPosition position, Sync
    SessionContext syncSessionContext)
       at Microsoft.Synchronization.KnowledgeProviderProxy.BeginSession(SYNC_PROVIDER_ROLE providerRole, ISyncSessionSt
    ate pSessionState)
       at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_S
    ESSION_STATISTICS& pSyncSessionStatistics)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, Syn
    cIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfiguration destinationConfiguration, SyncCallbacks Des
    tinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAdapter callbackChangeDataA
    dapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncDataConverter sourceConverter,
    SyncDataConverter destinationConverter, SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& chang
    esApplied, Int32& changesFailed)
       at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
       at Microsoft.Synchronization.SyncOrchestrator.Synchronize()

  • Thursday, March 01, 2012 5:31 PM
    Moderator
     
     
    does the sync framework created objects have a prefix of CESync? did you specify the object prefix as well when synching?
  • Thursday, March 01, 2012 6:39 PM
     
     
    Wow, this is interesting. When I looked at the newly provisioned file the sync tables that were created ignored the ObjectPrefix property. So in the sdf file there is no prefix to those sync tables. I commented the setting out and it worked. Is this a bug in the framework? Is there something else I am missing? I would like to have those prefixes in the sdf file if at all possible. As a side note I double checked the running code to verify the sync orchestrators set provider had the ObjectPrefix setting correct, so unless there is something else I am missing it is starting to look like a sync framework bug.
  • Thursday, March 01, 2012 6:58 PM
    Moderator
     
     Answered
    try setting the ObjectPrefix after you call PopulateFromScopeDescription and just before you call Apply.
    • Marked As Answer by KryptonianSon Thursday, March 01, 2012 7:44 PM
    •  
  • Thursday, March 01, 2012 7:45 PM
     
     
    There you have it. It must be set on both the provision object AND the provider object. Sheesh. You are the best! Thank you so much for your prompt help yet again. Thank you thank you thank you....
  • Thursday, March 01, 2012 7:56 PM
    Moderator
     
     

    yes, if you specified one in the provisioning, you must specify the same during sync.

    also, whenever you set settings like ObjectPrefix and other options, make sure to set them after the tables has been added to the scope description.

    for example, ObjectPrefix, when you set it's value, it loops thru the list of tables to set the prefix. if the tables has not been added yet, then it has nothing to set it to. so the tables added in the scope description after you set the ObjectPrefix dont have the ObjectPrefix.