Board index » delphi » invalid transaction handle (expecting explicit transaction start)

invalid transaction handle (expecting explicit transaction start)

procedure TForm1.ReconnectClick(Sender: TObject);
begin
  IBDatabase1.Connected := True;
  IBTransaction1.Active := True;
  IBDataSet1.Active := True;
end;

procedure TForm1.DisconnectClick(Sender: TObject);
begin
  IBDatabase1.ForceClose;
end;

when the InterBase server is running, i can disconnect and reconnect without
any problem.

but when InterBase server is not running, when tried to disconnect and
reconnect....i will get this message
raised exception class EIBInterBaseError with message 'invalid transaction
handle (expecting explicit transaction start)'.

how do i disconnect and reconnect without getting that error?

 

Re:invalid transaction handle (expecting explicit transaction start)


ForceClose should only be used in the direst of straights and should not be
considered a resumable state.  In some instances the IBTransaction can have its
Handle in a non null state leading to your problem if you try to re use it.  IBX
itself only uses ForceClose when destroying IBDatabase objects or it is definite
that the connection is gone.

Quote
wenkiat wrote:

> procedure TForm1.ReconnectClick(Sender: TObject);
> begin
>   IBDatabase1.Connected := True;
>   IBTransaction1.Active := True;
>   IBDataSet1.Active := True;
> end;

> procedure TForm1.DisconnectClick(Sender: TObject);
> begin
>   IBDatabase1.ForceClose;
> end;

> when the InterBase server is running, i can disconnect and reconnect without
> any problem.

> but when InterBase server is not running, when tried to disconnect and
> reconnect....i will get this message
> raised exception class EIBInterBaseError with message 'invalid transaction
> handle (expecting explicit transaction start)'.

> how do i disconnect and reconnect without getting that error?

You should be using Close and not ForceClose and handling the exceptions.  If
you want to continue once you have the server up and running again you should be
able to do a normal close and open again.

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
Anyone who cannot cope with mathematics is not fully human.
At best he is a tolerable subhuman who has learned to wear
shoes, bathe and not make messes in the house.   (Heinlein)

Re:invalid transaction handle (expecting explicit transaction start)


when i tried to issue, IBDatabase1.Connected := False when the interbase
server is shutdown,
i will get "connection lost to database" exception
when i start the interbase server, and tried to issue, IBDatabase1.Connected
:= True,
i will still get "connection lost to database" exception

i will only able to set IBDatabase1.Connected := True
after a few times of doing IBDatabase1.Connected := False (ignoring the
exception)

so, is there any way of writting a diconnect and reconnect function?

"Jeff Overcash (TeamB)" <overc...@onramp.net> wrote in message
news:3B11DAE1.F4ACA7CB@onramp.net...

Quote
> ForceClose should only be used in the direst of straights and should not
be
> considered a resumable state.  In some instances the IBTransaction can
have its
> Handle in a non null state leading to your problem if you try to re use
it.  IBX
> itself only uses ForceClose when destroying IBDatabase objects or it is
definite
> that the connection is gone.

> wenkiat wrote:

> > procedure TForm1.ReconnectClick(Sender: TObject);
> > begin
> >   IBDatabase1.Connected := True;
> >   IBTransaction1.Active := True;
> >   IBDataSet1.Active := True;
> > end;

> > procedure TForm1.DisconnectClick(Sender: TObject);
> > begin
> >   IBDatabase1.ForceClose;
> > end;

> > when the InterBase server is running, i can disconnect and reconnect
without
> > any problem.

> > but when InterBase server is not running, when tried to disconnect and
> > reconnect....i will get this message
> > raised exception class EIBInterBaseError with message 'invalid
transaction
> > handle (expecting explicit transaction start)'.

> > how do i disconnect and reconnect without getting that error?

> You should be using Close and not ForceClose and handling the exceptions.
If
> you want to continue once you have the server up and running again you
should be
> able to do a normal close and open again.

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> Anyone who cannot cope with mathematics is not fully human.
> At best he is a tolerable subhuman who has learned to wear
> shoes, bathe and not make messes in the house.   (Heinlein)

Re:invalid transaction handle (expecting explicit transaction start)


when i tried to issue, IBDatabase1.Connected := False when the interbase
server is shutdown,
i will get "connection lost to database" exception
when i start the interbase server, and tried to issue, IBDatabase1.Connected
:= True,
i will still get "connection lost to database" exception

i will only able to set IBDatabase1.Connected := True
after a few times of doing IBDatabase1.Connected := False (ignoring the
exception)

so, is there any way of writting a diconnect and reconnect function?

"Jeff Overcash (TeamB)" <overc...@onramp.net> wrote in message
news:3B11DAE1.F4ACA7CB@onramp.net...

Quote
> ForceClose should only be used in the direst of straights and should not
be
> considered a resumable state.  In some instances the IBTransaction can
have its
> Handle in a non null state leading to your problem if you try to re use
it.  IBX
> itself only uses ForceClose when destroying IBDatabase objects or it is
definite
> that the connection is gone.

> wenkiat wrote:

> > procedure TForm1.ReconnectClick(Sender: TObject);
> > begin
> >   IBDatabase1.Connected := True;
> >   IBTransaction1.Active := True;
> >   IBDataSet1.Active := True;
> > end;

> > procedure TForm1.DisconnectClick(Sender: TObject);
> > begin
> >   IBDatabase1.ForceClose;
> > end;

> > when the InterBase server is running, i can disconnect and reconnect
without
> > any problem.

> > but when InterBase server is not running, when tried to disconnect and
> > reconnect....i will get this message
> > raised exception class EIBInterBaseError with message 'invalid
transaction
> > handle (expecting explicit transaction start)'.

> > how do i disconnect and reconnect without getting that error?

> You should be using Close and not ForceClose and handling the exceptions.
If
> you want to continue once you have the server up and running again you
should be
> able to do a normal close and open again.

> --
> Jeff Overcash (TeamB)
>       (Please do not email me directly unless  asked. Thank You)
> Anyone who cannot cope with mathematics is not fully human.
> At best he is a tolerable subhuman who has learned to wear
> shoes, bathe and not make messes in the house.   (Heinlein)

Other Threads