views:

161

answers:

1

I am trying to set up a synchronization model to sync my consolidated Oracle database with a remote SQL Anywhere database. I have a couple Views on the consolidated Oracle database that I want to pull into the Sql Anywhere database as tables. I want to pull them over as they touch 4-5 tables (gotta love good normalization) and only have 7-8 columns that I need read access to (i.e. I will never try to update them. I just need to pull from the consolidated to the remote db). How do I do this?

+1  A: 

MobiLink can certainly support synchronizing with views, but that isn't supported in synchronization models because views don't have primary keys (which sync models need, as outlined on the first page of the wizard), and uploading to views requires an updatable view or "instead of" triggers.

A workaround is to temporarily define a table with the same schema as the view, plus appropriate primary key definitions. It would be simplest to use the same name for the table, but for that you'd need to use a different database. Pick that database/table when loading the consolidated schema, and define that table mapping to be download only.

Then you should be able to deploy that model to the Oracle database with the view. If you had to use a different name for the table than for the view, you should deploy to file and globally replace the table name with the view name in the generated SQL file.

Graham Hurst
Do you happen to know of any examples. To facilitate everything I created dummy tables in the DB that mimick the views and then in the download script I pull from the view instead of the table but I am still looking for some other examples/ideas.
runxc1 Bret Ferrier
Yes, there is a sample showing how to synchronize views that you can download from the iAnywhere - Mobilink area of the Sybase CodeXchange site. It's called "SQL Anywhere 10 - Synchronization using Views" but the techniques would be the same with version 11.
Graham Hurst
Could you edit your response to add the link the the CodeXchange article you are talking about.
runxc1 Bret Ferrier
Graham Hurst