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.
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
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...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com