Yes, you would use a timer. You'll have to experiment with the timing (too often and it thrashes).

You would select any message newer than the last message that was retrieved.

On Feb 13, 2008 7:49 PM, musky <muskvar@gmail.com> wrote:

then how do i have a thread periodically select the latest message from the
table?
should i use a timer or something

Donald McLean-3 wrote:
>
> You might also want to have a messageID and maybe a messageTimestamp.
>
> If everyone is connecting directly to the database server then you're just
> going to have to do a select periodically to see if anyone posted anything
> new.
>
> I don't know what kind of connection limits a database server has, but if
> your target audience is large enough, your architecture could break down
> (or
> even just bog down).
>
> On Feb 13, 2008 10:06 AM, musky <muskvar@gmail.com> wrote:
>
>>
>> also i dont want to use any sockets.
>> all the chat clients connect to the database server.
>>
>> musky wrote:
>> >
>> > i want to use derby as a chat server,
>> > my idea is to insert whatever a user types into a table in the
>> > database.This table can have two fields UserID and the
>> > message(VARCHAR).how do i convey the inserted message to the other
>> party??