This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Client Side Data Storage using HSQLDB

General questions regarding the development with JVx.

Client Side Data Storage using HSQLDB

Postby reycat67 » Tue Nov 09, 2010 7:32 am

Good day everyone!

As the topic suggest, would that be easier to do in JVx Framework? My reason for asking , is that, here in our country (Philippines), we always experience electricity brownout for hours, so the possibility of the client program to be disconnected with the remote server is very high. I don't want the client side program to become "useless" once the server is no longer available, like most web-based applications.

So, the idea is that the client program will switch connection to a local HSQLDB and a separate thread will do the uploading of records once the remote server is available again.

Any idea will be very much appreciated.

Posts: 4
Joined: Fri Nov 05, 2010 12:33 am

Re: Client Side Data Storage using HSQLDB

Postby Support@SIB » Tue Nov 09, 2010 1:23 pm

The framework does not support database switching (online/offline) and data synchronization out-of-the-box, but it is possible with JVx to realize this.

Which kind of web applications do you mean because JSF, GWT, JSP, HTML, Tapestry - general Ajax/HTML - apps does not work without server. I think, HTML5 storage API is something in this direction but not for large business apps and old browser versions does not support the API.

But before we discuss about facts, you should know that online/offline/online applications can generate a lot of problems, because

  • you need syncronized databases (tables, views, ...) (for client and server) - automatic migration
  • data synchronization
  • multi user problems when editing same records/tables
  • transactions
  • ...

You can use JVx to write multi tier applications but it is also not a problem to use apps as 2 tier (only change the connection) or as standalone desktop app (e.g. DirectServerConnection, ...).

The RemoteDataBook supports memory filtering and sorting:
Code: Select all

If you use memory sort/filter, then all data will be fetched, like
Code: Select all

If you set the the writeback isolation level to
Code: Select all

then the changed data will be sent to the server if you call
Code: Select all

If the server connection is interrupted, the server kills the session after the configured timeout. To change timeouts see Configuring Timeouts.

Another solution for your problem is, to use one RemoteDataBook for your local database and a RemoteDataBook for your remote server. To use a RemoteDataBook you can use the DirectObjectConnection (experimental in the repository - test source). This connection does not need a server and is used for test cases at the moment. Your UI should use the local RemoteDataBook and synchronize (manually - simple get/setValues) it with your server RemoteDataBook, if the server is available.

Also possible: Every client has its own database and loads all data from the server database and when possible the client writes all data to the server database (we don't recommend to use this option).

I hope this helps.
User avatar
Posts: 353
Joined: Mon Sep 28, 2009 1:56 pm

Re: Client Side Data Storage using HSQLDB

Postby reycat67 » Tue Nov 09, 2010 2:10 pm

I think the best solution to my problem is to use one RemoteDataBook for local database and another RemoteDataBook for remote server.

Thank you very much Sir!
Posts: 4
Joined: Fri Nov 05, 2010 12:33 am

Return to Development