Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Database Feed

  1. #11
    Member
    Join Date
    Jul 2008
    Location
    london
    Posts
    3

    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

  2. #12
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    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.


  3. #13
    Member
    Join Date
    Jul 2008
    Location
    london
    Posts
    3
    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

  4. #14
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Quote 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.

    Quote 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

  5. #15
    Member
    Join Date
    Apr 2008
    Location
    Nairobi
    Posts
    1

    Question 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

  6. #16
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,090
    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.

  7. #17
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521

    Exclamation

    A new updated example is available at http://www.lightstreamer.com/vb/show...=3899#post3899

 

 

Similar Threads

  1. .NET web service as Data Feed
    By icaiozzi in forum Adapter SDKs
    Replies: 1
    Last Post: November 19th, 2010, 12:52 PM
  2. How And Where To Specify Database As Data Feed?
    By devidasan in forum Adapter SDKs
    Replies: 1
    Last Post: March 17th, 2009, 12:00 PM
  3. .NET with external feed
    By markgoldin in forum Adapter SDKs
    Replies: 21
    Last Post: August 28th, 2008, 08:39 PM
  4. Database datafeed
    By Sinead in forum Adapter SDKs
    Replies: 4
    Last Post: February 14th, 2007, 04:47 PM
  5. Adapter Database Pulling
    By Excalibur in forum Adapter SDKs
    Replies: 4
    Last Post: October 3rd, 2006, 10:38 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 12:26 AM.