locked
Oracle - template and bulk procedures + GetScopeDescription map problems RRS feed

  • Question

  • Problem 1.

    I work on Oracle 11g and MSSQL2008 Sync Project and I found problem with BulkInserts in this topic :

    http://social.msdn.microsoft.com/Forums/nl/syncdevdiscussions/thread/744cc298-5c88-4ba3-a4f7-60689ac9d5ce

    I tried to add some data filtering based on templates on MSSQL side:

    SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(msConn, scopeDesc, SqlSyncScopeProvisioningType.Template);

    After sync I got error mentioned in topic above (Caught exception while applying changes: System.InvalidCastException: Specified cast is not valid.)

    So I tried to disable BulkProcedures again. But I got another problem during sync:

    "Microsoft.Synchronization.Data.DbProvisioningException: Cannot alter UseBulkProcedures when a scope is being created from a template"

    The only solution is to build adapters manually (I have never tried it yet)?
    Or I could add filters in another way without using templates?

    Problem 2.

    In another example I tried to do was Provision MSSQL on Oracle base using :

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

    And I have discovered that :

     scopeDesc.Tables[i].Columns[j].Type = ((OracleType)Int32.Parse(scopeDesc.Tables[i].Columns[j].Type)).ToString().ToLower();

    Maps float on int

    To be specyfic, this returns 13 - which is Type of int :

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

    This means destination table and procedures use integer instead of float.

    Problem 2 can be ignored since I can create MSSQL base myself. But Problem 1 is critical for me.
    Thanks for help in advance




    • Edited by TPiec Wednesday, March 28, 2012 10:58 AM
    Wednesday, March 28, 2012 10:54 AM

Answers

  • Problem 1 Solved ;)

    I was using provision template becasue of used parameter but I can filter columns without parameter. I mean I used FilterClause with hard coded param.

    To solve it I used:

    SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(ceConn, scopeDesc);

    instead of:

    SqlSyncScopeProvisioning serverTemplate = new SqlSyncScopeProvisioning(ceConn, scopeDesc, SqlSyncScopeProvisioningType.Template);

    and removed :

    serverProvRetail.PopulateFromTemplate(scopeName, "template_filter");

    and removed ofcourse params from serverTemplate.Tables["orders"].FilterClause = "[side].id=@p_id" and removed below:

    SqlParameter param = new SqlParameter("@p_id", SqlDbType.SmallInt);
    serverTemplate.Tables["orders"].FilterParameters.Add(param);

    This might be obvious for many of you, but not for me ;) and maybe this will help someone.

    Ofc JuneT site helped http://jtabadero.wordpress.com/2010/09/02/sync-framework-provisioning/

    • Edited by TPiec Wednesday, March 28, 2012 1:17 PM
    • Proposed as answer by JuneT Thursday, April 5, 2012 10:32 AM
    • Marked as answer by TPiec Thursday, April 5, 2012 10:53 AM
    Wednesday, March 28, 2012 1:11 PM