Tuesday, 21 August 2012

Example Step6:Test Synchronization

Finally, I recommend that you get a sense for how synchronization works between the Oracle Server and the device. Depending on the conflict resolution and other rules that you have set for your Publication and Publication items, it is pretty cool to see that synchronization does work! Since I had a rooted device, here is how I verified that two-way data synchronization was working as expected.

Step 1: Data Modified on Oracle Server
  • I logged in to the database as user AA using a SQL client
  • Issued a simple update to change one record in the ITEMS table
SQL> UPDATE items SET ITEM_DESCRIPTION = 'Sorry Grass is dark Green' WHERE ITEM_ID = 10;
SQL> COMMIT;

On my device, I fired up the Mobile Sync application and clicked 'Sync' and the verified that the data did get refreshed on my device.  Check out the screenshots provided if you are not sure how to do this.


Step 2: Data Modified on Device
  •  Use SQLite client on the device to modify a record using an UPDATE statement
  • Perform a manual sync and you should see the modification on the Server-side. I have provided a screenshot

    Download Screen Shots

15 comments:

  1. Hello Double A,
    Your post is really helpful. However, we couldnot follow two points:
    1. Did you not deploy the js in the form of a jar?
    2. The js needs to refer to sqlite or ORACLE database? As per the demo the sqlite gets created automatically on deployment. So, this question.

    ReplyDelete
    Replies
    1. Hi Som! I am not sure which js you are referring to. Assuming you are referring to the app.js in my Titanium project, my responses would be:

      - Titanium installs application by creating an APK file
      - The sqlite database is 'opened' using

      Titanium.Database.open('/sdcard/net.adkoli.dbtest/AA/TEST.db')

      Please let me know if I misunderstood your question.

      Delete
  2. Hello Double A,
    Thanks for your reply.I am however confused with certain points.
    Just wanted to know how the simple_sync_android application is actually creating the sqlite_db. I read the files FileManager.java,MainAct.java,TextFileEditor.java in details. But nowhere does it refer to any Oracle Database. As far as I know, the sync is supposed to take place between a back-end XE or so database and the sqlite_db. How is the sqlite_db thus created in this case? How and what is it syncing?

    ReplyDelete
    Replies
    1. I have not taken the time to inspect the Java sources included with simple_sync_android because I didn't need to (also I am disinterested in Java), but here is what I have observed.

      1. After I ran installed Mobile Sync app and sync'd it the first time, it created a database called default.db in the directory pointed to by DATA_DIRECTORY parameter (in my case I had changed the path to SD card)
      2. Additionally, I had packaged my publication and publication items into an app called TEST. After I installed the application TEST (from Oracle Update), it created a database named TEST.db which contained my publication and items. I verified this by running SQLITE3 and was able to see the tables and run queries on them.

      Delete
    2. Just to add..the Default.db and TEST.db are both SQLite databases as far as I can tell.

      Delete
  3. Hello Double A,
    Sorry but,here's few more questions
    1> What did you write in ose.ini to point to SDCard.?
    2> You created ose.ini for the TEST app? How did you read it?
    3> How did you sync the sqlite table with backend database??Did you write any sync logic??
    Thanks in advance

    ReplyDelete
  4. 1) OSE.INI

    This entry needs to be /sdcard and some path. I used /sdcard/. Mobile Sync appends the username automatically to the path provided here. So the database is created in /sdcard/net.adkoli.dbtest/AA. Also note that /mnt/sdcard/ did not work for me
    SQLITE.DATA_DIRECTORY=/sdcard/net.adkoli.dbtest

    2) In Mobile Sync app, click Settings on your device and you can see it. I already knew the path to the database. So in my Titanium app I have hardcoded path to Ti.Database.open

    3) Mobile Sync is the app that does it. Comes out of the box. I have not tried to poke around with Java sources to see what exactly it does.

    ReplyDelete
  5. Hi, I just read all of your posts and it seems that you have a real huge knowledge about Oracle DB. But from what I've read at your blog setting mobile projects with Oracle DB can be pain in the ass. Did you check other solutions as well? Do you have any experience with them?

    ReplyDelete
  6. Actually, it is not that complex. I got most of it installed and working within 48 hours of starting. There were some glitches (mostly the documentation was unclear in a few areas), but once I got around these...works like a charm.

    I did not try any other solutions simple because we already deploy 6 large apps in production around Oracle technology and I have comfort in this space due to my background.

    Suggest you try it out if you are starting afresh. You should be able to get a test environment going in 4-5 hours with these instructions from Step 1-6, good luck

    ReplyDelete
    Replies
    1. Yes, using your instructions should speed the process very much. But what I've read from your first posts it took you some time to have it up and running.
      Wasn't even the consideration for you to try some of more modern solutions offered in SaaS? The setup time nearly zero, and the learning curve is quit fast if you know Java or .Net. Of course it has to provide all the enterprise features like Oracle do and obviously should be able to talk Oracle DB without any problems. That combining could gain a lot of time savings.
      I have to say that I'm from mobeelizer.com - a company that is providing Enterprise Synchronization-as-a-Service solution.

      Delete
  7. All downloaded file is not exist could you help me to get it /

    ReplyDelete
  8. I am on the road for several weeks and do not have access to my dev environment. Exactly which screens are you looking for? For which Step? I will try to get one of my colleagues to post them.

    ReplyDelete
  9. rely I am need all attaches , I am learning it . specially this application can`t opent in my tablet http://oracledms.blogspot.com/2012/08/sample-app-step-2-install-mobile-sync.html . my tablet is android 4.2.2

    ReplyDelete
  10. Path Infotech is in the field of oracle training program from past several years.

    For more info : Oracle 10g Certification

    ReplyDelete