IBConfigService ShutdownDatabase

I use Delphi XE7 update 1 and Interbase XE3, Update 4 hotfix 3. The IBX version is 17.17. I have the following code to shutdown an interbase database:

IBConfigService1.DatabaseName:= 'TEST.gdb';
IBConfigService1.Active:= True;
IBConfigService1.ShutdownDatabase(Forced, 0);

When the last line is executed, I get an "EIBInterbaseError" exception: "Error writing data to connection".

Am I missing something? What do I need to do to make it work? I tried different things to no avail. e.g. increasing the wait seconds, using "application.processmessages" after the shutodowndatabase.

I have to mention that even though I'm getting the exception, the ShutdownDatabase IS disconnecting all current connections.
0
Mike
3/3/2015 6:56:24 PM
embarcadero.delphi.interbase 331 articles. 1 followers. Follow

3 Replies
648 Views

Similar Articles

[PageSpeed] 54

Mike Norayr Monjian wrote:
> I use Delphi XE7 update 1 and Interbase XE3, Update 4 hotfix 3. The IBX version is 17.17. I have the following code to shutdown an interbase database:
> 
> IBConfigService1.DatabaseName:= 'TEST.gdb';
> IBConfigService1.Active:= True;
> IBConfigService1.ShutdownDatabase(Forced, 0);
> 
> When the last line is executed, I get an "EIBInterbaseError" exception: "Error writing data to connection".
> 
> Am I missing something? What do I need to do to make it work? I tried different things to no avail. e.g. increasing the wait seconds, using "application.processmessages" after the shutodowndatabase.
> 
> I have to mention that even though I'm getting the exception, the ShutdownDatabase IS disconnecting all current connections.

DatabaseName should be the full path to the DB.  Also if you have active 
TIBDatabases you might want to shut them down first.

Here is the IBX unit test for ShutdownDatabase

Setup of component
{code}
   svcConfig.Params.Values['user_name'] := 'sysdba';
   svcConfig.Params.Values['password'] := 'masterkey';
   svcConfig.LoginPrompt := False;
   svcConfig.DatabaseName := PATH_TO_GDB + dmDataConvU.DBFileName;
   svcConfig.ServerName := WHERE_SERVER;
   svcConfig.Active := true;
{code}

use of component (options is one of the TShutdownMode options.
{code}
     IBDatabase1.Close;
     Sleep(10);
     try
       case Options of
         Forced:
           svcConfig.ShutdownDatabase(Options, Wait);
         DenyTransaction:
           svcConfig.ShutdownDatabase(Options, Wait);
         DenyAttachment:
           svcConfig.ShutdownDatabase(Options, Wait);
       end;
     except
       on E : EIBError do
          Comparer.LogFailure('Failed at shutdown Options ' + 
GetEnumName(TypeInfo(TShutdownMode),
                   integer(Options)) + ' Error Message ' + E.Message +
                   ' ErrorCode ' + IntToStr(E.IBErrorCode));
     end;
{code}

The sleep(10) is there due to under VM's sometimes you will get a Service not 
attached if you fire off things too fast, so gives the system just a little rest 
between the disconnect and the actual shutdown.  I suspect it was there for the 
error message you are getting but that was written like a decade ago.

Yes the case makes no sense.  It was probably refactored at some point and I 
didn't bother cleaning that up to the single line it could be reduced to.

Also note that while it kicks everyone out, Sysdba can always get back in so if 
you let people come in as sysdba you have only temporarily stopped people from 
getting in.

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
3/3/2015 10:01:12 PM
I forgot the calling code looks like

{code}
procedure IBconfigService.TestShutdownDatabase;
var
   Wait: Integer;
   Options: TShutdownMode;
begin
   options := IBX.IBServices.Forced;
   Wait := 0;
   FdmServices.ShutdownDatabase(Options, Wait);

   options := IBX.IBServices.DenyTransaction;
   Wait := 0;
   FdmServices.ShutdownDatabase(Options, Wait);

   options := IBX.IBServices.DenyAttachment;
   Wait := 0;
   FdmServices.ShutdownDatabase(Options, Wait);

   HasErrors;
end;
{code}

-- 
Jeff Overcash (TeamB)
       (Please do not email me directly unless  asked. Thank You)
And so I patrol in the valley of the shadow of the tricolor
I must fear evil. For I am but mortal and mortals can only die.
Asking questions, pleading answers from the nameless
faceless watchers that stalk the carpeted  corridors of Whitehall.
              (Fish)
0
Jeff
3/3/2015 10:02:38 PM
> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}
> I forgot the calling code looks like
> 
> {code}
> procedure IBconfigService.TestShutdownDatabase;
> var
>    Wait: Integer;
>    Options: TShutdownMode;
> begin
>    options := IBX.IBServices.Forced;
>    Wait := 0;
>    FdmServices.ShutdownDatabase(Options, Wait);
> 
>    options := IBX.IBServices.DenyTransaction;
>    Wait := 0;
>    FdmServices.ShutdownDatabase(Options, Wait);
> 
>    options := IBX.IBServices.DenyAttachment;
>    Wait := 0;
>    FdmServices.ShutdownDatabase(Options, Wait);
> 
>    HasErrors;
> end;
> {code}
> 
> -- 
> Jeff Overcash (TeamB)
>        (Please do not email me directly unless  asked. Thank You)
> And so I patrol in the valley of the shadow of the tricolor
> I must fear evil. For I am but mortal and mortals can only die.
> Asking questions, pleading answers from the nameless
> faceless watchers that stalk the carpeted  corridors of Whitehall.
>               (Fish)


Hi Jeff

I followed your steps and everything works fine. Just FYI, maybe it will help others too, I had followed all the steps you sent me above but with the following 2 differences:

1.) I was setting up the IBConfigService1 before closing the database.
2.) I was using IBConfigService.Databasename:= "localhost:c:\TEST.gdb", and was leaving the IBConfigService.ServerName blank.

I had to change them both to match with your steps for it to work. Changing just 1 didn't fix the problem.

One more thing, I added the following code after the ShutdownDatabase before performing any tasks on the database:
Sleep(2000).
0
Mike
3/4/2015 12:17:36 PM
Reply:

Similar Artilces:

delphi 7 interbase and firebird
Good day I am using the following Firebird-2.1.1.17910-0_Win32_embed_pdb flamerobin-0.9.0-win32 Delphi 7 Interbase express 6 component The error “unsupported on-disk structure for file c:\.....\email.gdb ; found 32779, support 10 Create a test database in Flame robin Did the following with Firebird; USAGE Just copy fbembed.dll, icudt30.dll, icuin30.dll and icuuc30.dll into the directory with your application. Then rename fbembed.dll to either fbclient.dll or gds32.dll depending on your database connectivity software. Then start your application ...

Delphi 7 Interbase TADOConnection
I was wondering how to connect Delphi 7 to an Interbase GDB file running on a Interbase XE3 developer edition server using a TADO Connection? In particular, what is the ConnectionString and what is the Provider. My path is C:\Interbase_Developer\Database\EMPLOYEE.GDB Thanks a lot, Eric > {quote:title=Eric Olender wrote:}{quote} > I was wondering how to connect Delphi 7 to an Interbase GDB file running on a Interbase XE3 developer edition server using a TADO Connection? In particular, what is the ConnectionString and what is the Provider. My path is > > C:\Interbas...

[InterBase] How connect by InterBase?
I want to connect to InterBase(DB) with PowerBuilder 6.5 .. Is that possible? but How connect ? If you have PB Desktop, you can't. Else, all you need is an ODBC driver. Using google I quickly located one: http://www.geocities.com/ibdatabase/index.html -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. MySybase http://my.sybase.com/mysybase Search Deja: http://www.pfcguide.com/_newsgroups/search.asp "Yun Ji Nam" <yunji.nam@technopia.net> wrote in message news:qBqt0TaIBHA.252@forums.sybase.com... > I want to connec...

Delphi and Delphi for .Net
It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. I would like to know is it true all .Net application is slower than Win32 native applicaiton or it is Delphi for .Net only. Your information is great appreciated, Inung On 2011-06-21 18:20:17 +0100, Inung Huang said: > It seems that Delphi for .Net is slower than Delphi Win32 native applicaiton. > I would like to know is it true all .Net application is slower than > Win32 native applicaiton or it is Delphi for .Net only. If you are only running the code in the application once then, yes, yo...

IBExpert not so tender about Delphi and Interbase...
From the latest IBExpert newsletter: "Are you still using Interbase? Perhaps you should think about changing to Firebird" "Btw: All new products created by IBExpert KG (except IBExpert Developer Studio, which is still compiled with Delphi5) are inplemented since 2011 with Lazarus. We are very happy that we made the step. For all Pascal Programmers, who do no want to change their language, but also do not want to pay every year thousands of euros per developer for buggy new Delphi versions, we recommend to consider using Lazarus ." Embarcadero DevRel should work mo...

connecting delphi Interbase : IBdatabase
Hi can you please explain to how using the component "IBdatabase",i can connect delphi 2006 to Interbase. I'm confused when we should connect to a .GDG file and when we shoud connect to data base stored in an interbase server? In fact i want to implement the second solution? Thankyou very much "boaubdi medi" wrote in message news:124803@forums.codegear.com... > > can you please explain to how using the component "IBdatabase",i can > connect delphi 2006 to Interbase. > > I'm confused when we should connect to a .GDG file ...

Interbase Admin palette on Delphi 2007
Hi, I'm trying to migrate my Delphi 7 applications to DElphi 2007. I've noticed that Delphi 2007 does not have the Interbase Admin palette. Does anybody know there is a way to install it, or Delphi 2007 really does not have this palette? Thanks. Make sure you have all of the updates from the registered users page installed. The IB Admin components should be there (at least they are in my copy of D2007). Also make sure that you have the IB client installed. -- Bill Todd (TeamB) What IB version do you have installed? Does Firebird make it work? > {quote:tit...

Where so I post Interbase Delphi XE2 quesrion?
I am new to Delphi XE2 abd cannot find a discussion group or form for posting Interbase questions.Please can someone post the link to it her? Thanks. Steve ...

Using Delphi and interbase with ASP.net
Is there any way to use Delphi and/or interbase with ASP.net? Any help would be appreciated. Thanks! The Borland website indicates that Delphi works with the .net framework. I have been chatting with a customer of mine who uses my custom controls in their development of websites using ASP.NET. So I think the answer is "yes" for Delphi. I recommend checking the Borland site (www.Borland.com) for details and FAQs.--- Peter BlumCreator of Peter's Data Entry Suite (formerly Professional Validation And More and Peter's Date Package) and Peter's Polling Packagewww.PeterBlu...

Delphi 2010 + InterBase Express + DBMemo (error)
Hi * I have a table in database (firebird 2.5 - UTF8 ) which conteins several fields: numeric, varchar, BLOB (subtype 1 - text). When I put on my form standard component TDBmemo and link to DataSource (to BLOB field), my applicatin after calling SelectSQL crushes - Access violation - Read access 000000EC. The same problem is when I use Memo components. When I remove this control (DBMemo) - application works fine without any problems. The question is: How to display BLOB (text) field in DBMemo or Memo control? Thank You very much in advance Regards Jacek Fągowski P.S...

Starting and Stopping Interbase Server from within Delphi code.
I am wondering if it is possible to start and stop the Interbase XE3 Server from within Delphi 7 code? Perhaps by using ADO Data Access Component or Interbase Data Access Components? Thanks in advance, Eric Eric Olender wrote: > I am wondering if it is possible to start and stop the Interbase XE3 Server from within Delphi 7 code? Perhaps by using ADO Data Access Component or Interbase Data Access Components? > > Thanks in advance, Eric You can shut down and bring on line databases, but not the server itself. For databases look at the IBX Admin pallet and the IBConfigSe...

problems with LoadFromFile in Delphi 2009 Win32 & Interbase
I have a application in Delphi 2007 that send a image like Blob data, and this Ok, but the same code in Delphi 2009 the data blob in Interbase is incomplete; how Can I resolve this problem; the code is the next: with SProc do begin StoredProcName:= 'SP_INSERT_IMAGE_DIG'; Prepare; ParambyName('I_IDE_INS_USR_SIS').AsString := 'USR000001A'; ParambyName('I_NUM_REG_CLI').AsString := 'a'; ParambyName('I_IMG_BLOB').LoadFromFile(inputFile+'.zlib',ftBlob); ParambyName('I_IDE_TIP_IMG&#...

SEPA components for Delphi with Source Code (Delphi 5
Hi all, in the european union change next year the Bankingformat to the SEPA Format. All peoples and companies must change the bankingssoftware and the costumer data form acountnummers in the new IBAN and BIC numbers. See: http://www.arma-it.de/shop/artikelueber.php?wgruppeid=211&wgruppe_offen=211 Functions: - generate SEPA XML'S - Calc IBAN - BIC Database (DE,AT and CH) Questions: vertrieb@arma-it.de PS: Bankinssoftware for Develpoers (Germany only) http://www.arma-it.de/shop/artikelueber.php?wgruppeid=212&wgruppe_offen=212 El 26/10/13 21:38, A...

Delphi 2007 to Delphi 7
I've written a class in Delphi 2007 that is not supported in Delphi 7. What would be the best way to achive what I've done in Delphi 2007 in Delphi 7? Thanks, Tom type BondConstants = class { Bond Types } type BondType = record const TREASURY = 3; AGENCY = 0; CORP = 1; MUNI = 2; SBA = 5; MBS = 4; CMO = 6; end; { Day Count Methods } type DayCount = record const ACTUAL_360 = 2; ACTUAL_365 = 1; ACTUAL_ACTUAL = 1; d30_360 = 0; ...

Web resources about - IBConfigService ShutdownDatabase - embarcadero.delphi.interbase

Resources last updated: 1/14/2016 5:35:02 AM