thank you, i do understand the concept of subscribe

Since the example shows that are are only subscribed to own item my question is where do you actually loop through the result set to subscribe to each item (with the unique key)

if i change the if (rs.next()) to while (rs.next()) it loops through all the records in the table but it updates only the first.

Can you show me where i would modify this code to subscribe to the unique items.

Thank you very much
Scott

Code:
import java.util.*;
import java.io.File;
import java.sql.*;
import com.lightstreamer.interfaces.data.*;

public class HelloWorldDataAdapter implements SmartDataProvider {

    private ItemEventListener listener;
    private volatile GreetingsThread gt;
    private Statement command;
	private final HashMap subscribedItems = new HashMap();
	/*
	 * used for the IndexedItemEvent version only (currently commented out)
     */
    private static final String[] names = new String[]{"message", "date"};

    
	
	
	public void init(Map params, File configDir) throws DataProviderException {
        try {
            Class.forName("com.mysql.jdbc.Driver").newInstance();
            String dbFile = "ls";
            String database = "jdbc:mysql://localhost:3306/ls";
            String url = "jdbc:mysql://localhost:3306/";
		String dbName = "ls";
			
			Connection conn = DriverManager.getConnection(url+dbFile, "user", "pass");
            command = conn.createStatement();
        } catch (Exception ex) {
            System.out.println(ex);
            throw new DataProviderException(ex.getMessage());
        }
    }

    public boolean isSnapshotAvailable(String itemName) throws SubscriptionException {
        return false;
    }

    public void setListener(ItemEventListener listener) {
        this.listener = listener;
    }

    public void subscribe(String itemName, Object itemHandle, boolean needsIterator)
            throws SubscriptionException, FailureException {
        if (itemName.equals("greetings")) {
            gt = new GreetingsThread(itemHandle);
            gt.start();
        }
    }
    
    public void subscribe(String itemName, boolean needsIterator)
                throws SubscriptionException, FailureException {
    }           

    public void unsubscribe(String itemName) throws SubscriptionException,
            FailureException {
        if (itemName.equals("greetings") && gt != null) {
            gt.go = false;
        }
    }

    class GreetingsThread extends Thread {

        private final Object itemHandle;
        public volatile boolean go = true;

        public GreetingsThread(Object itemHandle) {
            this.itemHandle = itemHandle;
        }

    
	


		public void run() {
            int c = 0;
            Random rand = new Random();
            
			while(go) {
                try {
					ResultSet rs = command.executeQuery("select * from data");       
                    
					
					
					
					if (rs.next()) {
                        Map<String, String> data = new HashMap<String, String>();
                        data.put("message", rs.getString("message"));
                        data.put("timestamp", rs.getString("timestamp"));
                        listener.smartUpdate(itemHandle, data, false);

                    }
                } catch (Exception ex) {
                    System.out.println(ex);
                }                    
                
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                }
            }
        }
    }

}