How can I check if connection is active?

The BETA tester's forum for ZeosLib 7.2 Report problems. Ask for help, post proposals for the new version and Zeoslib 7.2 features here. This is a forum that will be edited once the 7.2.x version goes into RC/stable!!

My personal intention for 7.2 is to speed up the internals as optimal a possible for all IDE's. Hope you can help?! Have fun with testing 7.2
Soner
Fresh Boarder
Fresh Boarder
Posts: 4
Joined: 12.02.2017, 17:00

How can I check if connection is active?

Postby Soner » 28.09.2017, 12:21

Hello,
in my program I have active TZConnection with Firebird datebase, then I connect with TFBAdmin to the Database server to change password from other user. When I do this TZConnection looses the connection, but the program does not know about it, ZConnection1.Connected is true and ZConnection1.Ping is also true. Now when I execute a sql command then TZConnection gives error:
"SQL Error: Invalid database handle (no active connection)..."
How can I check success full if then connection is really active?





I use Lazarus 1.6.4, fpc 3.0.2, Zeos 7.2.1-Svn 3951, Firebird 2.5 Database

marsupilami
Gold Boarder
Gold Boarder
Posts: 591
Joined: 17.01.2011, 14:17

Re: How can I check if connection is active?

Postby marsupilami » 04.10.2017, 14:21

Hello Soner,

hmmm - currently the Firebird driver doesn't support pinging the server. But usually you should get an exception telling you that this operation is not supported...

But: Changing the password of a user should not kill other connections. Maybe it is a good idea to use Zeos for changing the password using the corresponding SQL from Firebird 2.5 (See corresponding part of Firebird 2.5 Language Ref. Update):
Firebird 2.5 Language Ref. Update wrote:ALTER USER username
[PASSWORD 'password']
[FIRSTNAME 'firstname']
[MIDDLENAME 'middlename']
[LASTNAME 'lastname']
[{GRANT|REVOKE} ADMIN ROLE]

-- At least one of the optional parameters must be present.
-- GRANT/REVOKE ADMIN ROLE is reserved to privileged users.


With best regards,

Jan


Return to “ZeosLib 7.2 Betatest Forum”

Who is online

Users browsing this forum: No registered users and 1 guest