ibec_ShutdownDatabase

Syntax

 function ibec_ShutdownDatabase(Database : string; Options : string) : variant;

ibec_ShutdownDatabase performs a shutdown of the database specified with the Databaseparameter (connection string for the database) using the Firebird Services API.

The Options variable specifies additional connect and shutdown parameters:

Connection options

User=<user_name>User Name
Password=<password>Password
ClientLib=<path>Path to the client library file
ExpectedDBSee Example 6 below.

Shutdown options

Wait=<seconds>Timeout in seconds
DenyTransaction | DenyAttachmentShutdown Action
Mode=<mode>Shutdown mode. Possible values are Multi, Single and Full. If Mode is not specified Multi will be used by default. This option is available for Firebird 2.5 and above.

ibec_ShutdownDatabase returns NULL in case of success. Otherwise it returns an error message.

Examples

1. Shutdown a database aborting all connections and transactions

    Res = ibec_ShutdownDatabase('localhost:d:\data\mydb.fdb',
                            'ClientLib="d:\FBlientLibs\fbclient25.dll";
                             User=SYSDBA; Password=masterkey');

2. Shutdown a database preventing new connections

    Res = ibec_ShutdownDatabase('localhost:d:\data\mydb.fdb',
                            'ClientLib="d:\FBlientLibs\fbclient25.dll";
                             User=SYSDBA; Password=masterkey; DenyConnection');

3. Shutdown a database preventing new transactions

    Res = ibec_ShutdownDatabase('localhost:d:\data\mydb.fdb',
                            'ClientLib="d:\FBlientLibs\fbclient25.dll";
                             User=SYSDBA; Password=masterkey; DenyTransaction');

4. Shutdown with timeout 1 minute

    Res = ibec_ShutdownDatabase('localhost:d:\data\mydb.fdb',
                            'ClientLib="d:\FBlientLibs\fbclient25.dll";
                             User=SYSDBA; Password=masterkey; Wait=60');

5. Shutdown and don't allow any connections from anyone, even SYSDBA or the database owner.

    Res = ibec_ShutdownDatabase('localhost:d:\data\mydb.fdb',
                            'ClientLib="d:\FBlientLibs\fbclient25.dll";
                             User=SYSDBA; Password=masterkey; Mode=Full');

6. Using ExpectedDB

     Res = ibec_ShutdownDatabase('localhost:d:\mydb.fdb',
                            'ClientLib=C:\Program Files (x86)\HK-Software\IBExpert\firebird3\fbclient.dll;
                             Password=masterkey; User=SYSDBA;
                             ExpectedDB=d:\mydb.fdb');

back to top of page
<< ibec_OnlineDatabase | IBEBlock | ibec_DropDatabase >>