Hi there,
I have to make a decision as to whether we can use Lightstreamer for a new project. Is there prospect of sample code for database integration being provided to developers in the near future.
Regards
Gerard
Printable View
Hi there,
I have to make a decision as to whether we can use Lightstreamer for a new project. Is there prospect of sample code for database integration being provided to developers in the near future.
Regards
Gerard
I modified the HelloWorldDataAdapter to poll a database, instead of generating the data internally.
Please consider this is just a five-minute effort and I've not tried to compile the code. Please let me know if you find any errors.
This Data Adapter uses JDBC to query an Access file ("C:/Data.mdb"). Every second, it reads the first record, extracts the "message" and "timestamp" fields and injects them into the Lightstreamer Kernel.
Dear Alessandro, thank you for the code. I have two questions. I don't see in the code why it just reads the "first record" - isn't it looping over the entire record set and sending them all. Secondly, if the value of a field hasn't changed since the last time it was sent to Lightstreamer, does this field value still get sent to the client.
Many thanks
Gerard
Because in this example we suppose that the first record maps a subscribed item. So, each change in this record is pushed to the clients. In real-world scenarios, you could have different mappings.Quote:
Originally Posted by gerard
The Lightstreamer Server will take care of sending the clients only the changed values. So if no fields have changed, the Server will automatically avoid sending messages to the clients.Quote:
Originally Posted by gerard
Cheers
Alessandro
hi Alessandro when I compile the jdbc adapter code above i get the exception - symbol : constructor DataProviderException(java.lang.Exception)
location: class com.lightstreamer.interfaces.data.DataProviderExce ption
throw new DataProviderException(ex);
1 error
Sorry, you are right; there is probably a typo, because only a DataProviderException constructor that takes a String object is available.
Please use ex.getMessage(). We'll fix the above code.
A new updated example is available at http://www.lightstreamer.com/vb/show...=3899#post3899