Synchronization Services with oracle RRS feed

  • Question

  • I have changed the walkthrough example from the documentation to synchronize an oracle database table (ms oracle driver). With varchar columns it seems to work but with number columns I get an error "SyncSchema does not have sufficient information for 'FIELDX'. The following information is missing: 'Precision/Scale".



    • Moved by Max Wang_1983 Friday, April 22, 2011 11:17 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Friday, February 23, 2007 11:02 AM


  • Ture, once you have client store datatypes different than server store datatypes generating schema automatically using the Select statement does not work with all types. To solve this problem, the ServerSyncProvider exposes the SyncSchema property. By default this property is not set. This tells the provider to generate the schema using the Select statement you supplied in every SyncAdapter. You can use this property to manually author the schema to map the server datatypes to similar ones that the client database supports. Let's take an example, let's say your table (TEST_TABLE) has one column called (myNumCol) of type Number(8); the generated schema from the Oracle provider is not complete leads to the error you pointed out regarding precision and scale, the code below should fix this:
    SyncSchema syncSchema = new SyncSchema();
    serverProvider.Schema = syncSchema;
    syncSchema.Tables["TEST_TABLE"].Columns["myNumCol"].AllowNull = false;
    syncSchema.Tables["TEST_TABLE"].Columns["myNumCol"].ProviderDataType = "NUMERIC";
    syncSchema.Tables["TEST_TABLE"].Columns["myNumCol"].NumericPrecision = 8;
    syncSchema.Tables["TEST_TABLE"].Columns["myNumCol"].NumericScale = 0;
    syncSchema.Tables["TEST_TABLE"].PrimaryKey = new string[] { "myNumCol" };  // here I make the column a primary key

    You will need to add the rest of the columns in your table, if any, to the sync schema (which is not shown in the snippets). In fact, authoring sync schema should perform better than automated generation for obvious reasons. It just requires a lot more code.

    I am sure you can find a good map for FILEDX type. My knowledge of Oracle is very limited to know that :)

    Friday, February 23, 2007 4:33 PM