Sync for Oracle with SQL Express as client in version 2.1 RRS feed

  • Question

  • Please, can somebody give me an example?

    I use this example: http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=3761 and I build an Analogous class for SQL Express but where do SyncOperationStatistics stats = orchestrator.Synchronize(); if provider.ObjectSchema is null or empty receive the error "The specified conversion is not valid" otherwise the error is "The current operation could not be completed because the database is not provisioned for sync or you not have permissions to the sync configuration tables."

    If somebody has any idea, please, tell me.

    Tuesday, October 12, 2010 5:09 PM

All replies

  • am not sure why you built a new class to handle SQL Express, you can use the built-in SQLSyncProvider for that  by simply replacing SQLCESyncProvider with SQLSyncProvider.

    which provider is raising the error? SQL or Oracle?

    Tuesday, October 12, 2010 11:42 PM
  • Hello JuneT

    Forget the analogous class for SQL Express, this is the client provider code (SQL Express)


    public SqlSyncProvider ConfigureSQLSyncProvider(SqlConnection sqlConnection){


    SqlSyncProvider provider = new SqlSyncProvider();

    provider.ScopeName = SyncUtils.ScopeName;

    provider.Connection = sqlConnection;

    return provider;


    This is the types convertion from Oracle to SQL Express:


    private void CheckIfProviderNeedsSchema(RelationalSyncProvider localProvider){

    if (localProvider as SqlSyncProvider != null){



    SqlSyncScopeProvisioning sqlConfig = new SqlSyncScopeProvisioning((SqlConnection)localProvider.Connection);


    if (!sqlConfig.ScopeExists(localProvider.ScopeName)){

    DbSyncScopeDescription scopeDesc = ((DbSyncProvider)ceSharingForm.providersCollection["Server"]).GetScopeDescription();


    for (int i = 0; i < scopeDesc.Tables.Count; i++)


    for (int j = 0; j < scopeDesc.Tables[i].Columns.Count; j++)

    { scopeDesc.Tables[i].Columns[j].Type = ((



    if (scopeDesc.Tables[i].Columns[j].Type == "number")

    { scopeDesc.Tables[i].Columns[j].Type =

    "numeric"; }


    if (scopeDesc.Tables[i].Columns[j].Type == "nvarchar")

    { scopeDesc.Tables[i].Columns[j].Size =

    "100"; } } }

    sqlConfig.PopulateFromScopeDescription(scopeDesc); sqlConfig.Apply();

    } } }

    After of this routine the database structure is created in SQL Express then while is executed next



    stats = orchestrator.Synchronize();

    raised an exception of InvalidCastException "The specified conversion is not valid" in Source: Microsoft.Synchronization, TargetSite: Void Start(CONFLICT_RESOLUTION_POLICY, _SYNC_SESSION_STATISTICS ByRef), StackTrace: in Microsoft.Synchronization.Data.SqlServer.SqlChangeHandler.ApplyBulkChanges(DataTable dataTable)

    in Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChangesInternal(DbSyncScopeMetadata scopeMetadata, IDbTransaction transaction, FailedDeleteDelegate_type failedDeleteDelegate, DataSet dataSet, ChangeApplicationType applyType)

    in Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, IDbTransaction applyTransaction, DataSet dataSet, DbSyncSession DbSyncSession, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)

    in crosoft.Synchronization.Data.RelationalSyncProvider.SingleTransactionApplyChangesAdapter.Apply(DataSet dataSet, Boolean commitTransaction, FailedDeleteDelegate_type failedDeleteDelegate, String batchFileName, ChangeApplicationAction& action)

    in Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, DataSet dataSet, DbSyncSession dbSyncSession, Boolean commitTransaction)

    in Microsoft.Synchronization.Data.RelationalSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)

    in Microsoft.Synchronization.KnowledgeProviderProxy.ProcessChangeBatch(CONFLICT_RESOLUTION_POLICY resolutionPolicy, ISyncChangeBatch pSourceChangeManager, Object pUnkDataRetriever, ISyncCallback pCallback, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)

    in Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS&

    Wednesday, October 13, 2010 6:05 PM
  • have you check all your oracle data types if they needed to be converted apart from the ones above?

    you may also try setting SetUseBulkProceduresDefault to false

    Thursday, October 14, 2010 1:12 AM
  • JuneT.

    I am converting well the types to SQL Express (int, datetime and nvarchar(100)). Just I want to take this example: http://code.msdn.microsoft.com/sync/Release/ProjectReleases.aspx?ReleaseId=3761 Oracle as server to SQL CE as client and convert it to Oracle as server to SQL Express as client. I just changed SqlCeSyncProvider by SqlSynProvider, SqlCeConnection by SqlConnetion, RelationalSyncProvider by KnowledgeSyncProvider (CheckIfProviderNeedsSchema). The database is created but orchestrator.Synchronize() raised an apparent error of data types conversion. Please, if you can give me your email to send you the project and check it or send me a custom sample. It must be a little mistake but I do not find it.

    Thursday, October 14, 2010 5:52 PM
  • i dont have an Oracle installation on my machine right now, but send them thru anyway and ill take a look if i can spot the potential issue.
    • Edited by JuneT Thursday, March 29, 2012 9:10 AM
    Friday, October 15, 2010 1:58 AM