January 27th, 2010, 02:39 PM
-
Disconnecting from the firbird database
Hi all,
I was wondering if there is an easy way to kill all connections to the Firebird database using queries...
As in, a user is done with a project so he decides to close it without shutting down the whole program to open another project with a different database.
Right now we are manually getting rid of every single connection we have made, but sometimes we forget some and it makes the program crash.
So is there a "kill all" query?
Thanks
Armen
January 28th, 2010, 06:40 AM
-
you can use the Database shutdown from the Firebird Services API
Originally Posted by Amren.Kitbalian
Hi all,
I was wondering if there is an easy way to kill all connections to the Firebird database using queries...
As in, a user is done with a project so he decides to close it without shutting down the whole program to open another project with a different database.
Right now we are manually getting rid of every single connection we have made, but sometimes we forget some and it makes the program crash.
So is there a "kill all" query?
Thanks
Armen
Comments on this post
January 28th, 2010, 10:25 AM
-
Originally Posted by nagysz
you can use the Database shutdown from the Firebird Services API
Thanks the isc_dpb_shutdown will probably work!
I will try it out
Armen
January 28th, 2010, 11:18 AM
-
It can be done through SQL depending on the Firebird version, it's called "terminating a client" in the 2.5 release notes.
Terminating a Client
The MON$ structures are, by design, read-only. Thus, user DML operations on them are prohibited. However, a mechanism is built in to allow deleting (only) of records in the MON$STATEMENTS and MON$ATTACHMENTS tables. The effect of this mechanism is to make it possible, respectively, to cancel running statements and, for ODS 11.2 databases, to terminate client sessions.
To cancel all current activity for a specified connection:
Code:
DELETE FROM MON$STATEMENTS
WHERE MON$ATTACHMENT_ID = 32
To disconnect all clients except the “Me” connection:
Code:
DELETE FROM MON$ATTACHMENTS
WHERE MON$ATTACHMENT_ID <> CURRENT_CONNECTION
Last edited by pabloj; January 28th, 2010 at 11:27 AM.
January 28th, 2010, 11:49 AM
-
Originally Posted by pabloj
It can be done through SQL depending on the Firebird version, it's called "terminating a client" in the 2.5 release notes.
wheeeew, the 2.5 promises to bring some really exciting features. i can't wait to see the stable version to port my databases to 2.5
where can i get a good documentation on 2.5?
i have the Hellen Borrie's The Firebird eBook for 2.0, but that's faaaaaar from complete
January 28th, 2010, 12:37 PM
-
Yes, it's very promising.
As far as docs go there are a few blog posts and slides linked on www.firebirdnews.org, I also did a few blog posts about it but right now the best source are the release notes and the readme files that go with each firebird installation (i.e. "c:\program files\firebird\firebird_2_5\doc\sql.extensions").
I hope the Firebird team will sooner or later update the sample database to showcase the new features of each release.
About the porting, you might want to start experimenting now as Fb 2.5 is close to RC2, should be declared stable very soon.
Last edited by pabloj; January 28th, 2010 at 12:42 PM.