#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0

    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    19
    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

    • Amren.Kitbalian agrees
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Posts
    14
    Rep Power
    0
    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
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,517
    Rep Power
    543
    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.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    19
    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
  10. #6
  11. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,517
    Rep Power
    543
    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.

IMN logo majestic logo threadwatch logo seochat tools logo