ADF mobile Data sync and sql lite usage

Hi,
We are working on ADF mobile POC.(Jdev version 11.1.2.3.0)
Following Oracle mobile developer guide we generated "Webservice data control" which creates process(object) method to work with Webservice. We created the data-controls and used them in our Java code and are able to get the Webservice response also.
However we want to implement the offline mode feature and for this we are not able to get any document reference for implementation.
With offline mode support is it the application's responsibility to store the data locally using SQL Lite and do the data sync (using Web Service) OR will the framework would do the data sync automatically. Can someone please provide the implementation hint on how to do the Offline mode support in the mobile application using ADF.
Thanks
Pavan

Hi,
With offline mode support is it the application's responsibility to store the data locally using SQL Lite and do the data sync (using Web Service) OR will the framework would do the data sync automatically.
This is all you. In this version of ADF Mobile there is no automatic data synchronization between local data and the server side. The sample that come with the ADF Mobile extension have a SQLLIte example as well, which is in the HR application. Look for the "DBConnectionFactory" file
package application;
import java.sql.Connection;
import java.sql.SQLException;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
public class DBConnectionFactory {
    public DBConnectionFactory() {
        super();
    protected static Connection conn = null;
    public static Connection getConnection() throws Exception {
        if (conn == null) {
            try {
                // create a database connection
                String Dir = AdfmfJavaUtilities.getDirectoryPathRoot(AdfmfJavaUtilities.ApplicationDirectory);
                String connStr = "jdbc:sqlite:" + Dir + "/HR.db";
                conn = new SQLite.JDBCDataSource(connStr).getConnection();
            } catch (SQLException e) {
                // if the error message is "out of memory",
                // it probably means no database file is found
                System.err.println(e.getMessage());
        return conn;
}The LifeCycleListenerImpl class in the same demo shows how to use this SQL Lite connection
package application;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import javax.el.ValueExpression;
import oracle.adfmf.application.LifeCycleListener;
import oracle.adfmf.framework.api.AdfmfJavaUtilities;
public class LifeCycleListenerImpl implements LifeCycleListener {
    public LifeCycleListenerImpl() {
     * The start method will be called at the start of the application. Only the
     * Application Lifecycle Event listener will be called on start up.
    public void start() {
        System.out.println("!!!!!!!!!!!!!! App Start !!!!!!!!!!!!!!");
        //InitDB();
        try {
            Statement stat = DBConnectionFactory.getConnection().createStatement();
            ResultSet rs = stat.executeQuery("SELECT * FROM EMPLOYEES;");
        } catch (SQLException e) {
            // if the error message is "out of memory",
            // it probably means no database file is found
            System.err.println(e.getMessage());
            System.out.println("Database does not exist, creating it");
            InitDB();
        } catch (Exception e) {
            System.err.println(e.getMessage());
        System.out.println("!!!!!!!!!!!!!! Done App Start !!!!!!!!!!!!!!");
     * The stop method will be called at the termination of the application. Only
     * the Application Lifecycle Event listener will be called on start up.
     * NOTE: Depending on how the application is being shutdown, this method may
     * or may not be called. Features should save off their state in the deactivate
     * handler.
    public void stop() {
        // Add code here...
     * The activate method will be called when the feature is activated. The
     * Application Lifecycle Event listener will be called on application
     * being started and resumed.
    public void activate() {
        // Add code here...
     * The deactivate method will be called when the feature is deactivated. The
     * Application Lifecycle Event listener will be called on application
     * being hibernated.
    public void deactivate() {
        // Add code here...
    private void InitDB() {
        try {
            System.out.println("!!!!!!!!!!!!!!InitDB Start!!!!!!!!!!!!!!");
            ClassLoader cl = Thread.currentThread().getContextClassLoader();
            InputStream is = cl.getResourceAsStream(".adf/META-INF/hr.sql");
            if (is == null) {
                System.err.println("###### Could not look up : /META-INF/hr.sql");
                return;
            BufferedReader bReader = new BufferedReader(new InputStreamReader(is));
            List stmts = new ArrayList();
            String strstmt = "";
            String ln = bReader.readLine();
            while (ln != null) {
                if (ln.startsWith("REM") || ln.startsWith("COMMIT")) {
                    ln = bReader.readLine();
                    continue;
                strstmt = strstmt + ln;
                if (strstmt.endsWith(";")) {
                    System.out.println(strstmt);
                    stmts.add(strstmt);
                    strstmt = "";
                    ln = bReader.readLine();
                    continue;
                ln = bReader.readLine();
            DBConnectionFactory.getConnection().setAutoCommit(false);
            for (int i = 0; i < stmts.size(); i++) {
                Statement pStmt = DBConnectionFactory.getConnection().createStatement();
                pStmt.executeUpdate((String)stmts.get(i));
            DBConnectionFactory.getConnection().commit();
            System.out.println("!!!!!!!!!!!!!!InitDB Done!!!!!!!!!!!!!!");
        } catch (Exception e) {
            e.printStackTrace();
}Hope this is what you were looking for
Frank

Similar Messages

  • ADF Mobile: Data synchronization

    Hi,
    I'm currently investigating some ADF Mobile related things for a client.
    One of these this is the synchronization of data. Since ADF Mobile (currently) doesn't support something ootb I'm checking my options here.
    What would you guys suggest (maybe an other suggestion)?
    Performance and reliability are important of course.
    Thanks in advance!

    Shay Shmeltzer wrote:
    For offline access you'll want to use the local SQLite DB.
    For synchronization you need decide if you just need a DB to DB synch and then you might be able to use Oracle Database Mobile Server 11g:
    http://www.oracle.com/technetwork/products/database-mobile-server/overview/index.html
    Thanks for your reply, I will take a look at the Oracle Database Mobile Server.
    Edit:
    After reading trough the documentation of Oracle Database Mobile Server (and googling) I found out that there is no support for iOS devices.
    Since we are using ADF Mobile for Android and iOS, we are looking for something that works on both devices.
    Any suggestion?

  • Mobile data(3g and edge) on lumia 620

    Hi,
    i have problem with connecting my Lumia phone to mobile data, i tried connecting through 2g, the browser was working but not my messenger apps including WhatsApp, so i tried connecting through 3g and WhatsApp, Skype and none of my messenger apps seem to work with 3g data too, with wifi all these work fine, has anybody faced similar issue, please help

    There may be a problem with your apn settings. Your phone is designed to retrieve the settings from your sim card. Unfortunately not all sim cards support this especially iof you have an old sim or sometimes the sim could be faulty. My suggestion for the moment are to make sure you have the latest version of the Access Point app on your phone and if that does not resolve then contact your provider so see if function is supported or try a replacement sim. 
    You can doenload the latest version of Access Point using the Link to the QR code below.
    http://discussions.nokia.com/t5/Pool-of-Knowledge/​Nokia-Windows-Phone-8-App-Updates/td-p/1640082

  • ADF Mobile Error handling and redirect

    I'm stuck on how to handle errors within my ADF Mobile application. My application consumes a number of web services and we have found we often get error messages when phone connections switch from wifi to 3g or lose connection altogether. These are errors such as SSL handshake failure, HTTP500 errors, and also errors where it can't display the binding eh "Unable to get value for the property due to invalid binding iterator" because a WS call has failed. From the little information I can find - and none of it specific to ADF Mobile, I think I need to write an error handler class which I set against ErrorHandlerClass in databinding.cpx - if that correct? Am I able to catch these errors using that method and if so has anyone got any examples at all. Ideally what I'd like to do when I've caught those errors is redirect to another page (showing something like facebooks app does when it loses a connection and says tap to try again), does anyone have any suggestions or examples?
    thanks
    lynsey

    A sample for ADF Mobile Error Handling.
    SDA013
    Error Handling in ADF Mobile
    https://java.net/projects/smuenchadf/pages/ADFMobile#SDA013

  • Mobile Data disabling and affecting phone settings

    Hi,
    Every now and again my phone will prompt that mobile data is disabled. When that happens, the display settings I have set (2mins to auto screen lock and brightness) reset to their original settings. Does anyone know what is happening or how I fix it?
    Thanks

    No problem, Stamina Mode operates all the time, not just when the battery is low.
    What are your thoughts about this forum? Let us know by doing this short survey.
     - Official Sony Xperia Support Staff
    If you're new to our forums make sure that you have read our Discussion guidelines.
    If you want to get in touch with the local support team for your country please visit our contact page.

  • PC to phone data Sync and FF history questions

    Hi there,
    I’m a old firefox user and have been using FF on my PC since long, but recently I’ve started using it in my Android (Note 3) I have few question regarding this:
    1) The reason I’m using FF in my Note 3, I’ve lots of bookmark in my PC I want them all in my phone as well. So I use basic sync feature to get them all. I’ve also few saved password which I want in my phone also. But I see FF stores all sync data in there server and I can clear them too after login. But I question is this safe to store data in FF server? Does it provides a secure encrypted method?
    2) When sync my PC FF data I sync history too, and I’ve long history in my PC, but when it sync to phone, the phone only shows very small history. Only upto last week, is that the Android FF version feature that it will show history for a week only? Or anything else?

    Hi guigs2,
    Thanks a lot for your feedback, yes I’ve many questions.
    1# “If you swipe down from the top of the navigation and tap on the sync icon you will see all the tabs and synced list.” Do you mean under setting? Under setting I see there have sync option to choose like bookmark, tabs, pass etc.
    1# I was using FF28 on my PC and its old sync feature and it was working flawlessly and properly sync all. But after the 29update I found FF released a new sync method and I moved to that. But what I found it really not sync properly. I’ve over 5k bookmark in my PC and when sync with my phone (Note3) it didn’t sync all. I ran the sync multiple time and leave it long to do its purpose but it didn’t. I also tried adding, deleting some from my PC and then sync again, but nothing helps. Also 29 Sync doesn’t sync passwords with master password. Then for all (except Note 3) I went back to FF 28 and started using old sync method. Also the old sync account shows how many data uploaded and a option for user to clear them, which I use frequently for safety purpose but that’s missing in the new sync. Also the
    2# is there any way to import bookmark manually on android? Because when I do sync all desktop bookmarks shows under ‘desktop’ directory. But it would be helpful if all are stored in root bookmark place.
    3# another PC FF related question is: is there any way for the bookmark sidebar shortcut icon in FF 29. I see its missing in 29 and the new icon only shows a dropdown menu. But as I’ve long list of bookmarks, so sidebar is best for me. I know the keyboard shortcut (ctrl+B) but I’m habituated with the icon.
    Thanks in advance!

  • LR Mobile stopped syncing and still isn't syncing after recent updates! Please help!!

    Running LR 5.6 on my iMac and LR Mobile on my iPad and iPhone.
    The syncing worked for the most part... sometimes I had to delete the cache on my desktop to trigger syncing but nothing works to make the LR sync.
    I have created new collections in LR on desktop and marked them to sync with LR Mobile, at the same time I stopped syncing some other collections... My Web and iPad collections have not updated. They show the collections for which the syncing was turned off in LR Desktop. I can't get it to sync. Please help. My perfect photo workflow is broken now.
    And by the way, all my apps on iPhone and iPad are up to date.

    Could you please send me a LR Desktop diagnostig log  - best as a private message with a downloadable dropbox link.
    You can trigger the log via LR Desktop preferences -> Lightroom Mobile and when you hold down the alt key you will notice a generate diagnostic log button.
    Thanks
    Guido

  • SQL Developer 1.1.0.21: Issues with Data Grid and SQL syntax checking

    In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion.
    Is there any option to change this behavior?
    Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check.
    I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql.
    Manish

    "In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
    In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
    "Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
    The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
    "I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
    On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
    I use version 1.0.0.15.57 and seems to be working allright.
    - Babu Rangasamy

  • Multiple data flow and sql tasks in a container - are records available in other tasks before transaction commits?

    If I have 3 data flow tasks A > B > C
    Then a SQL task that executes a procedure.
    Can the procedure refer to records that have been added in one of the previous data flow tasks?
    All the tasks are in a container that will commit when its finished, but if its not finished yet, will the SQL task and the procedure be able to refer to any of the records that were loaded?

    That depends on how you handle connections.  Changes made in a transaction are visible to only the connection that made the changes until the transaction commits or rolls back.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Data Miner and SQL Developer

    Is there any way to use the Data Miner 10.2.0.3.1 as an extension to SQL Developer 1.1.3.
    Any hints/comments are appreciated!

    Hi,
    We should have a new extension in a month or so.
    In the meanwhile, you can generate code from Data Miner directly and copy/load it into SQLDeveloper, or use JDeveloper.
    Thanks, Mark

  • Data modeler and Sql Developer

    Just downloaded sqldeveloper 3 EA - and the ability to drag a schema into data modeler for a quick logical diagram is gone.
    Can this only be done now in the separate data modeler product?

    It's still there - you can drag&drop tables from SQL Developer browser only to empty relational model diagram. Pressing Ctrl key will change the behavior - all child tables also will be imported.
    You can drag&drop object types on data types model diagram.
    Now you have more possibilities - to rearrange/format and print diagram, to generate DDL.
    Philip

  • Adf faces, data control and more than one session context ?

    I already put the question in the forum but nobody answered may be my question may not be so clear so i would put it again with other words.
    Each xml page definition are instantiated in a binding container for a http session, you are able to get the data with bindings or data that represent the current binding container (bindings) or a given container corresponding to an another page that the current (data).
    It is perfect when you don't allow multiple instances of the same page in the same application session. Browser are now offering tab management that allow user to navigate through multiple applications just by changing the current tab. It's very useful. I imagine that user's will be using it also in my application and will use it to compare or more simply just watch about two different entities of the same type (the same xml page definition, the same object instantiated in the binding container).
    Because the binding container is associated with the http session all tabs will share the same one, isn't ? So i understand the problem and that it is forbidden to have many identical page for a single instance in the binding container because of synchronization issues.
    Is all that i said true ?
    Is it a way to solve this type of problem ?
    Will this problem be addressed by adf faces and data controls ?
    Hope somebody will answer !
    Message was edited by:
    micwic

    I already put the question in the forum but nobody answered may be my question may not be so clear so i would put it again with other words.
    Each xml page definition are instantiated in a binding container for a http session, you are able to get the data with bindings or data that represent the current binding container (bindings) or a given container corresponding to an another page that the current (data).
    It is perfect when you don't allow multiple instances of the same page in the same application session. Browser are now offering tab management that allow user to navigate through multiple applications just by changing the current tab. It's very useful. I imagine that user's will be using it also in my application and will use it to compare or more simply just watch about two different entities of the same type (the same xml page definition, the same object instantiated in the binding container).
    Because the binding container is associated with the http session all tabs will share the same one, isn't ? So i understand the problem and that it is forbidden to have many identical page for a single instance in the binding container because of synchronization issues.
    Is all that i said true ?
    Is it a way to solve this type of problem ?
    Will this problem be addressed by adf faces and data controls ?
    Hope somebody will answer !
    Message was edited by:
    micwic

  • Does firefox mobile app sync and save passwords?

    I am just wondering if firefox home saves online passwords and uses a master password. if yes how do I access? If no is there a mobile password app that plays well with firefox home?

    Sorry, Firefox Home for iOS does not sync or save passwords. If you want to sync passwords from Firefox to your iPhone/iOS device, you'll need to use a third-party program like LastPass: https://lastpass.com/

  • Help with date format and sql

    Hi
    I am a complete oracle idiot.
    I have created a table with 2 columns po_id,po_date. Yhe id data type is number,date type is date. To add values to the table i enter something like
    "insert into purchase_orders(po_id,po_date) values(1,01/01/2004)"
    It does not accept the date and will not add the record, i have also tried the date format 01-Jan-2004.
    What is the proper way to add the date.
    Thanks
    Garry

    You probably want to use an explicit to_date cast. That lets you specify the format of the date string, i.e.
    INSERT INTO purchase_orders( po_id, po_date )
      VALUES( 1, to_date( '01/01/2004', 'DD/MM/YYYY' );Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Data Modeler and SQL Server

    Is was testing the beta and wanted to show someone how to reverse engineer a scheme.
    We have used CA-ERWIN for this in the past.
    I used import and configured my driver after going to general options and pointing at the JDTS.JAR and restarting it. 1.2.2 version
    It keesp saying UNABLE to FIND the REQUIRED DRIVER
    See documentation to load 3rd party jdbc drivers.

    Hello,
    you can find description in release notes http://www.oracle.com/technology/products/database/sql_developer/files/ReleaseNotes525.htm
    Best regards,
    Philip

Maybe you are looking for