• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Offline/online working of application

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi! I have developed an application for online purpose.My problem is my client want the same to work in offline also.I am using ms sql server as back end tool.Also the user is restricted to view only some contents .
a)My problem is how do i make it work offline.
b)how to i export database created offline to my server
c)how to restrict imported database only to his/her concerns .
Please help me asap.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like a job for a Design Pattern. You could manage the interface between the program and JDBC bits with an extra level of abstraction - ie it could be viewed as a Decorator for the JDBC bits.
The 'online' bits stay the same, but create a 'Persistence Manager' that wraps around it. When called, the PM checks for a valid network connection. If this succeeeds, it provides a direct interface to the old JDBC code. Otherwise, it invisibly caches the data in the local version for later on.
This solves points 1 and 3. To solve part two, you can have the PM also detect the fact that a connection didn't exist but now daoes and can replicate data back. Or this could be a separate process.
There will be a problem with managing unique keys, but a solution I like is to have each client process have the 'high bits' predetermined, and be allowed to set the 'low bits' itself. eg the local client might have a 'local key base' of 0110-0000 (this is just an 8-bit example) and is then free to allocate all keys from 0110-0000 to 0110-1111.
Now I've thrown this out (from the top of my head, so be gentle ) Arguments?
Dave
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, and I forgot to say:

Stop The World I Want To Get Off


"Charlie Brown" quote?
 
sharad goswami
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could u suggest code for that.How do u do it?please
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You already have some JDBC code.
To manage the 'safe unique key' code, each client needs its own 'high bit' value that it can safely use to hand out primary keys while it isn't connected to the server. ie: A class that knows about the high end,and knows how to generate the low end bits. All this class does is hand out unique keys when they are requested.
Finding the high could also be done as a query the first time a client connects to the server, but it would be easier to crate it via a configuration setting.
To manage the Decorator (ie the tricky bit), you have a class that you delegate to and it handles database operations rather than you making database operations yourself. Exactly what the Decorator looks like depends on what your original database operations look like...
Typically it should look exactly the same from the 'outside'. The difference would be that you have rewritten the methods so that instead of calling your JDBC code directly, it tests to see if it is on or offline, then optionally calls the local or remote database...
 
Tongue wrestling. It's not what you think. And here, take this tiny ad. You'll need it.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic