-
October 2nd, 2008, 01:33 PM
#11
Database Sample Code
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
-
October 3rd, 2008, 12:27 PM
#12
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.
-
October 9th, 2008, 02:00 PM
#13
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
-
October 10th, 2008, 10:18 AM
#14
Originally Posted by
gerard
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.
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.
Originally Posted by
gerard
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.
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.
Cheers
Alessandro
-
December 22nd, 2009, 02:00 PM
#15
compilation exception in error handling
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
-
December 23rd, 2009, 10:10 AM
#16
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.
-
January 27th, 2012, 03:58 PM
#17
Similar Threads
-
By icaiozzi in forum Adapter SDKs
Replies: 1
Last Post: November 19th, 2010, 11:52 AM
-
By devidasan in forum Adapter SDKs
Replies: 1
Last Post: March 17th, 2009, 11:00 AM
-
By markgoldin in forum Adapter SDKs
Replies: 21
Last Post: August 28th, 2008, 07:39 PM
-
By Sinead in forum Adapter SDKs
Replies: 4
Last Post: February 14th, 2007, 03:47 PM
-
By Excalibur in forum Adapter SDKs
Replies: 4
Last Post: October 3rd, 2006, 09:38 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 06:55 AM.
Bookmarks