Topic
  • 1 reply
  • Latest Post - ‏2009-05-04T11:40:23Z by ClausSamuelsen
SystemAdmin
SystemAdmin
228 Posts

Pinned topic Informix Dynamic Server Scheduler question

‏2009-04-22T16:46:34Z |
Hi!

I'm working on a project at my faculty. It's a java desktop application with an informix database. I have a problem using informix dynamic server scheduler.
I have a particular table in my database. This table contains records that are inserted by the desktop aplication I'm developing. These records must be deleted when the user closes the application. I implemented a WindowListener in my application that does that.
The problem is what to do if the application crashes or the connection to the database breaks.
I went to my professor and he told me to use informix dynamic server scheduler.
I added a new column to my table and this column contains session id of my application's connection. So if the application crashes, the session is no longer active. All I have to do is to periodically (for example every 60 seconds) issue a DELETE statement that deletes all the records from my table that contain a session id which is not among the active database sessions.
I created the statement and it works fine when I execute it in SQL editor. I think I'm doing something wrong while inserting the task into the sysadmin:ph_task table.
The task seem to execute periodically every 60 seconds but it doesn't delete records.
I looked at the records in ph_run table and it has records regarding my task. The ret_value is 0.
Can someone help me? I have a deadline and I'm getting very close to it.
Here is the DELETE query I'm trying to execute in my task:

DELETE FROM odrzavanje:kljuc WHERE idsession NOT IN (select sid from sysmaster:syssessions)

"odrzavanje" is the name of my database.
"kljuc" is the name of the particular table.
"idsession" is the column that contains the session id.

It would be very helpful to me if someone could post an INSERT statement which inserts the task into the ph_task table so I can try it out.
In the meanwhile I'll try to solve the problem by myself.

Sorry if it is a stupid question. I'm a newbie regarding all this advanced Informix features and I really don't have much time to explore.

Thanks!
Updated on 2009-05-04T11:40:23Z at 2009-05-04T11:40:23Z by ClausSamuelsen
  • ClausSamuelsen
    ClausSamuelsen
    11 Posts

    Re: Informix Dynamic Server Scheduler question

    ‏2009-05-04T11:40:23Z  
    Just saw your message. Hope you haven't passed your deadline yet.

    The standard method to solve this problem is to create a temporary table, when the application connects. As soon as the application disconnects (controlled or uncontrolled) IDS will automatically drop the temporary table.

    Regards
    Claus