I am new to database and i am working on an application which has a gigaspace based cache and the backend data is a sybase database.
Unfortunately there are a lot of places from where the DB gets updated via stored procs. Hence i would like to have a way via which i can get notifications whenever my DB is updated.
After doing some research i found that sybase does has the ability to send out events to Tibco EMS but unfortunately it requires separate license.
Is there any other reliable way i can get table update notifications without using a messaging system like may be some kind of rest ?
You can send a message to a UDP port using syb_sendmsg(); this requires some configuration settings but no license. Note that UDP is not as reliable as TCP.
If you don't want to use any more licensed options you could make a trigger on the table and put code in the trigger that would send data to JMS.
Or it can call some custom Java class (Java in database) that could do virtually anything.
Another options i to use XP server and call some external program that would populate the cache or JMS queue.
Related
I am working on an application where I have to consolidate data from clients into a central DB.
The problem is that how can I monitor any data changes (save, update, delete) on clients in real time. I there any way out for that?
I am using Hibernate for data fetching from clients in batches. Checking every row of data and comparing it cell-wise with central DB is not practical. There are about 25 tables that I have to work on.
Appreciate any help or hint.
Regards
DB2 cannot do this for you.
You need two things:
Catch all write operations in your web application. If you know the actions/URLs/servlets this is your starting point. Or give hibernate listeners a chance.
If you need real time update of your web clients. You should look for web sockets. This allows a server-client communication. With a web socket you can tell your web clients to update their data once it has been changed by an other client.
If a Java-based web application needs to update clients based on a database record update using server sent events, are there ways to getting the database updates via a callback mechanism from a database to a servlet so that a java servlet does not need to continuously poll a database to detect for updates?
There is nothing in the JDBC specification (that I know of) that will allow you to do this. If at all, this is a database-specific functionality. Oracle supports such functionality starting Oracle 11g:
http://docs.oracle.com/cd/E18283_01/java.112/e16548/dbchgnf.htm
I am creating a web application. Same application will run from different machine, but
they will use common database. When application starts it will get all data from database.
But when I update data from one application, how other running application will know that data
has been updated, I want when I update database form any application, other running
application will get notification immediately, and they should update their data.
One possible solution is I can take all applications URL in a list, then after updating value
I will send request to all application, but how to do this using send Redirect. Is it correct way ? or is their any other easiest way to do this. Please help me.
Is it a requirement that data is loaded once on startup? If it's not than you can just read directly from the database with a low cache invalidation time.
In case your apps need to be synchronized "almost immediately" I would do it like this:
You can set up a messaging server which would create a JMS topic. All of the clients will listen to messages from that topic. When one of the apps update something in the DB it will send a message to the topic. The rest of the apps will get the message and update.
My application should be syncronized with a ServerDB to collect some Data all users input.
How to do that in android? Through xml and evaluating these through self writen queries? Or is there a more elegant solution?
This is a good thread for you How to communicate with server's database from android phone?
Basically, you should not use a JDBC / SQL connection directly as it doesn't suit mobile needs. But you build a web service your database on the server and communicate through the service to update your database and get refreshed data from it.
Take a look at the SampleSyncAdapter sample app.
Android apps can sync their content provider with a web-based database using the SyncAdapter class, which handles many of the details of scheduling and running synchronization. Sync adapters will try to avoid conflicting with each other, they won't run when the network is unavailable, and the user can configure them from the Accounts settings.
Even if your app is the only one using the mobile database, you should use a content provider, to allow the system to manage interaction between the db and the web.
Have a look in :
http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
I'm currently developing a Field-Service application that stores data in the local sqlite database on an android device. At some point, usually after completing the data collection rounds, the local sqlite db is to be synchronized to a remote sybase db on the server.
Any suggestions as to how this could be achieved or engineered as a solution? Or even better, are there alternatives to synchronizing data in such an application?
There are two general solutions that come to mind:
You could have the device send the data to your server in some sort of text format (json, xml, etc) and implement a web service that collects the data. However, both the device and web service will need to understand the protocol.
You could also have the device send the raw database file to a web service and have it open the database, read the file (via SQL) and copy out the necessary bits. However, this couples your device and server to the database schema, but might be less work to actually send the data.
Either way, you'll need some sort of web service to listen for the data that the device wants to send back. The only sticky part is which mechanism you choose.