This discussion is archived
12 Replies Latest reply: Jul 18, 2013 1:12 AM by vasileios RSS

Question regarding mobile client sync

Hasith Newbie
Currently Being Moderated

Hi guys,

      Is there a way to sync a android mobile client to a back end oracle database without having to create users on the Oracle Database Mobile Server? Because in my scenario the mobile users are stored in a table at the back end, and new users can be added periodically. I need the ability to sync them by using their IDs. Is there a way to do this?

 

Thank You.

  • 1. Re: Question regarding mobile client sync
    userBDBDMS Guru Moderator
    Currently Being Moderated

    DMS works off a schema defined in the repository.   The portion of that schema that a client application can see is done through a publication.   A publication can consist of 100% of that schema or a subset of it.      If you add additional users to your Oracle backend db, and those user have access to the same schema then what ever syncing is done by the clients will be visible to the new users.   If the new users establish a new schema and a publication has not been set up, then they cannot be synced to.

     

    thanks

    mike

  • 2. Re: Question regarding mobile client sync
    Hasith Newbie
    Currently Being Moderated

    thanks for your reply Mike.

     

    You have talked about a subset of the schema. Is it possible to create a publication by filtering the table rows by a user.

    As an example,

       I have a table called Orders on the backend DB. This table has a column called UserID. This UserID belongs to the mobile user in the Users table in my DB. Is it possible to create a publication for the Orders table by filtering on the UserID column for the mobile user? Is it possible to link a record in the Users table to a user created in the DMS?

  • 3. Re: Question regarding mobile client sync
    userBDBDMS Guru Moderator
    Currently Being Moderated

    yes

  • 4. Re: Question regarding mobile client sync
    Hasith Newbie
    Currently Being Moderated

    Can you please give me the steps or point me to an article?

     

    Thanks

  • 5. Re: Question regarding mobile client sync
    userBDBDMS Guru Moderator
    Currently Being Moderated

    Hi,

     

      Kindly refer to our docs.  Oracle® Database Mobile Server Developer's Guide is a great place to start, please look at Chap 2, dealing with publications and publication items.  You will need to set up synchronization type (manual, automatic), refresh mode, data subsetting (this is where you can select specific rows for specific users to access).  


      Have you purchased a license for Database Mobile Server yet?   What type of application are you developing?  What platforms are you planning on developing on?   Do you need assistance in getting in contact with an Oracle sales rep?  


    thanks

    mike


  • 6. Re: Question regarding mobile client sync
    vasileios Explorer
    Currently Being Moderated

    in 10gr3 you could do :

    open workbench create a publication, then in the publication item enter the e.g. select * from table where mycolumn:=mycolumnvar

    mycolumnvar is the data subsetting value.then in webtogo page you go to each user and select datasubsetting and enter the value for the mycolumnvar (e.g. their id). this is how you tell olite how to sync.

     

    if you dont want to create users in olite you could have one user then sync all (so all devices have the same info)

    and then from inside your application you make the appropriate select statements so you retrieve the specific results.

    i dont recommend this approach because if you are not careful it might be the case that 2 users update the same row and then you will get conflicts.

     

     

    i guess 11g works pretty much the same on this one

  • 7. Re: Question regarding mobile client sync
    Hasith Newbie
    Currently Being Moderated

    Hi mike,

         Thanks for the info. I went though the docs and found the way to manage it. Our application is a Sales Force Automation solution for companies to manage their mobile sales force. We currently use MS SQL Server. We are planing to migrate to Oracle. Yes we have installed the necessary components.

     

    thanks

    Hasith

  • 8. Re: Question regarding mobile client sync
    Hasith Newbie
    Currently Being Moderated

    Hi vasileios,

     

    Thanks for your reply. Yes, I now understand how to do the filtering. The only issue is having to create users manually.

     

    Thanks

    Hasith

  • 9. Re: Question regarding mobile client sync
    vasileios Explorer
    Currently Being Moderated

    hi

    there are many things you could do for that.

    e.g. if the users are added in a table you could make a trigger each time a new user is entered and  enter his info in another table (lets call it NewUsers). Then make a service that watches over this NewUsers table every lets say 5 mins(?) and if it finds a new user then it will go and add it in oracle lite as user. you can see the code in the other thread initiated by gambro2.

     

    if the users are added by the handheld then you can make a web service that executes the code posted in gambro2 question that adds the new users.

    if you perform a sync between olite database and another one(perhaps an erp) put the checks there.

  • 10. Re: Question regarding mobile client sync
    Hasith Newbie
    Currently Being Moderated

    Hi,

         Thanks so much for the info. I checked the thread initiated by gambro2, and I think using the java API is the solution. Can you please give me a link to download the API?

     

    Thanks

    Hasith

  • 11. Re: Question regarding mobile client sync
    vasileios Explorer
    Currently Being Moderated

    i posted the answer in the other thread. ok just bare in mind that the solution is for 10gr3 which is the version we use here.

    since you want the 11g you probably need the

    http://docs.oracle.com/cd/E22663_01/index.htm

    code shouldnt be that diffrent (i dont think oracle changed this part much)

    for instance about creating user you will look at

    http://docs.oracle.com/cd/E22663_01/doc.11100/e22677/sync.htm#autoId27

     

    2.4.1.1 Create the Mobile Server User

    Use the createUser method of the MobileResourceManager object to create the user for the publication.

    1. Create the MobileResourceManager object. A connection is opened to the mobile server. Provide the schema name, password, and JDBC URL for the database the contains the schema (the repository).
    2. Create one or more users with the createUser method. Provide the user name, password, the user's real name, and privilege, which can be one of the one of the following: "O" for publishing an application, "U" for connecting as user, or "A" for administrator. If NULL, no privilege is assigned.

      Note:

      Always request a drop user before you execute a create, in case this user already exists.
    3. Commit the transaction, which was opened when you created the MobileResourceManager object, and close the connection.
    MobileResourceManager mobileResourceManager = new MobileResourceManager(CONS_SCHEMA, DEFAULT_PASSWORD, JDBC_URL); mobileResourceManager.createUser("S11U1", "manager", "S11U1", "U"); mobileResourceManager.commitTransaction(); mobileResourceManager.closeConnection(); 

    Note:

    If you do not want to create any users, you do not need to create the MobileResourceManager object.

     

    its the same as the 10gr3. please check the other thread also

    i also see it says

    Use the Resource Manager APIs to..blablabla.. See the oracle.mobile.admin.MobileResourceManager in the Oracle Database Mobile Server JavaDoc, which is located off the ORACLE_HOME/Mobile/doc/index.htm page.

     

    so you have all you need in your server already(jars)

  • 12. Re: Question regarding mobile client sync
    vasileios Explorer
    Currently Being Moderated

    i can send you a sample project just email me at billaras1234@hotmail.com

    (your email is private here so i dont see it so i can send it to you)

     

    my sample project is kinda sloppy but it gets the work done (as far as i remember:)   )

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points