Can 4GL-program sleep over taking Online down and up
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Hello, Is there a way a 4gl-program can sleep over and continue execution if there is a Online engine state change when program is sleeping. I've tried to close database before sleep and then open it again but I get "Network receive failed.." Thank's for any comments to this (stupid) question! Pentti
I can't tell you for sure, but I really doubt it. When you bounce the engine, the shared memory segments are going to be dropped, and the TCP ports will be closed and reopened. Once that happens, any open cursors you have will go away. Even if you don't have any open cursor, if you're connecting via shared memory, the memory segments will need to be remapped, and if you're using TCP, the server socket will be closed, disconnecting the client, which in turn will require the client to reconnect. I don't know about any other connection method. One way I can think of it surviving is if you close your connection to the database, sleep until the database is offline, then start attempting to reconnect until the connection succeeds. The problem with this is that you can't know exactly when the database is going to go down, so you won't have a chance to cleanly disconnect, unless you write some script to bring down the database which sets some semaphore or sets a flag in a file (and sleeps for some period of time before actually bringing the database down) that the 4gl program checks frequently. Frankly, I'm not very confident that even this will work... In article <8hqp42$kvq$1@tron.sci.fi>, "Pentti Tiet'v'inen" <pat@sci.fi> wrote: > Hello, > Is there a way a 4gl-program can sleep over and continue execution if there > is a Online engine state change when program is sleeping. > I've tried to close database before sleep and then open it again but I get > "Network receive failed.." > > Thank's for any comments to this (stupid) question! > Pentti > > -- # unrm / ksh: unrm: not found # man cpio Sent via Deja.com http://www.deja.com/ Before you buy.
"Pentti Tietäväinen" wrote: > Is there a way a 4gl-program can sleep over and continue execution if there > is a Online engine state change when program is sleeping. > I've tried to close database before sleep and then open it again but I get > "Network receive failed.." You should be able to do it, but you probably need version 7.3 I4GL which supports the connection statements (directly -- you can use the ESQL/C code in the IIUG archive for 6.00 and later versions of I4GL). You'd either DISCONNECT before the sleep or when you get the network receive failed error, and then reconnect. Of course, any transaction would be rolled back, all cursors would be lost, and so would all prepared statements and temporary tables. Etc. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>
I've got some code that inadvertently did this last week. I decided to
bounce the engine, forgetting that 10 or 12 processes were still active.
Then came that 'Oh....!' moment, but they had kept on going. Yes, they'd
reported errors, but had retried and reconnected when the engine re-
appeared. Much more by luck than judgement....
Be prepared for some strange errors when the database is coming up
though. There can be quite a delay between you giving the 'oninit' and
the engine being ready for real work...
Andy.
In article <3941DC55.3731433E@earthlink.net>, Jonathan Leffler
<jleffler@earthlink.net> writes
>"Pentti Tietäväinen" wrote:
>
>> Is there a way a 4gl-program can sleep over and continue execution if there
>> is a Online engine state change when program is sleeping.
>> I've tried to close database before sleep and then open it again but I get
>> "Network receive failed.."
>
>You should be able to do it, but you probably need version 7.3 I4GL
>which supports the connection statements (directly -- you can use the
>ESQL/C code in the IIUG archive for 6.00 and later versions of I4GL).
>
>You'd either DISCONNECT before the sleep or when you get the network
>receive failed error, and then reconnect. Of course, any transaction
>would be rolled back, all cursors would be lost, and so would all
>prepared statements and temporary tables. Etc.
>
>
>
>
>--
>Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
>Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN
>#include <disclaimer.h>
>
>
Andrew Lennard andy@kontron.demon.co.uk