Cannot perform operation -- DB is not open

Hi,
I know that IBX is not supported to work Firebird but this never happened until now, and so far IBX, for years, always worked impecable with Firebird.
So the problem is with this code:

procedure TDMRecolha.DataModuleDestroy(Sender: TObject);
begin
  if TTemp.InTransaction then
    TTemp.RollBack;
  if TValida.InTransaction then
    TValida.RollBack;
  qFechaDocumento.FreeHandle;
  qFechaDocumento_Max.FreeHandle;
  qInsertMovimentoTemp.FreeHandle;
  qUpdateMovimentoTempB.FreeHandle;
  qUpdateMovimentoTemp_Publica.FreeHandle;
  qUpdateMovimentoTempBMapas.FreeHandle;
  qUpdateMovimentoTempC.FreeHandle;
  qDeleteMovimentoTemp.FreeHandle;
  qDeleteMovimentosTempDoTipo.FreeHandle;
  qDeleteTemp.FreeHandle;
  qUpdateTempDisplay.FreeHandle;
  qDeleteTempDisplay.FreeHandle;
  qInsertTempDisplay.FreeHandle;
  qUpdateSaldoTempDisplay.FreeHandle;
  qLerTotaisGeral.FreeHandle;
  qLerTotaisAnalitica.FreeHandle;

  TValida.StartTransaction; // I GET, IN THIS LINE, THE ERROR "Cannot perform operation -- DB is not open"
  with qTemp do
  begin
    Sql.Clear;
    Sql.Add('DROP TABLE ' + TempTable);
    ExecQuery;

    Sql.Clear;
    Sql.Add('DROP TABLE ' + TempTable1);
    ExecQuery;
  end;
  TValida.Commit;
end;

So why this happens? Not always but sometimes it happens and the IBDatabase.Connected property is "True", I checked it.

Thanks
0
Carlos
5/7/2015 11:13:31 AM
embarcadero.delphi.interbase 331 articles. 1 followers. Follow

4 Replies
2096 Views

Similar Articles

[PageSpeed] 25

What version of Delphi?

Carlos Matos wrote:
> Hi,
> I know that IBX is not supported to work Firebird but this never happened until now, and so far IBX, for years, always worked impecable with Firebird.
> So the problem is with this code:
>
> procedure TDMRecolha.DataModuleDestroy(Sender: TObject);
> begin
>    if TTemp.InTransaction then
>      TTemp.RollBack;
>    if TValida.InTransaction then
>      TValida.RollBack;
>    qFechaDocumento.FreeHandle;
>    qFechaDocumento_Max.FreeHandle;
>    qInsertMovimentoTemp.FreeHandle;
>    qUpdateMovimentoTempB.FreeHandle;
>    qUpdateMovimentoTemp_Publica.FreeHandle;
>    qUpdateMovimentoTempBMapas.FreeHandle;
>    qUpdateMovimentoTempC.FreeHandle;
>    qDeleteMovimentoTemp.FreeHandle;
>    qDeleteMovimentosTempDoTipo.FreeHandle;
>    qDeleteTemp.FreeHandle;
>    qUpdateTempDisplay.FreeHandle;
>    qDeleteTempDisplay.FreeHandle;
>    qInsertTempDisplay.FreeHandle;
>    qUpdateSaldoTempDisplay.FreeHandle;
>    qLerTotaisGeral.FreeHandle;
>    qLerTotaisAnalitica.FreeHandle;
>
>    TValida.StartTransaction; // I GET, IN THIS LINE, THE ERROR "Cannot perform operation -- DB is not open"
>    with qTemp do
>    begin
>      Sql.Clear;
>      Sql.Add('DROP TABLE ' + TempTable);
>      ExecQuery;
>
>      Sql.Clear;
>      Sql.Add('DROP TABLE ' + TempTable1);
>      ExecQuery;
>    end;
>    TValida.Commit;
> end;
>
> So why this happens? Not always but sometimes it happens and the IBDatabase.Connected property is "True", I checked it.
>
> Thanks
>
0
quinn
5/7/2015 3:48:47 PM
Carlos Matos wrote:
> Hi,
> I know that IBX is not supported to work Firebird but this never happened until now, and so far IBX, for years, always worked impecable with Firebird.
> So the problem is with this code:
> 
> procedure TDMRecolha.DataModuleDestroy(Sender: TObject);
> begin
>   if TTemp.InTransaction then
>     TTemp.RollBack;
>   if TValida.InTransaction then
>     TValida.RollBack;
>   qFechaDocumento.FreeHandle;
>   qFechaDocumento_Max.FreeHandle;
>   qInsertMovimentoTemp.FreeHandle;
>   qUpdateMovimentoTempB.FreeHandle;
>   qUpdateMovimentoTemp_Publica.FreeHandle;
>   qUpdateMovimentoTempBMapas.FreeHandle;
>   qUpdateMovimentoTempC.FreeHandle;
>   qDeleteMovimentoTemp.FreeHandle;
>   qDeleteMovimentosTempDoTipo.FreeHandle;
>   qDeleteTemp.FreeHandle;
>   qUpdateTempDisplay.FreeHandle;
>   qDeleteTempDisplay.FreeHandle;
>   qInsertTempDisplay.FreeHandle;
>   qUpdateSaldoTempDisplay.FreeHandle;
>   qLerTotaisGeral.FreeHandle;
>   qLerTotaisAnalitica.FreeHandle;
> 
>   TValida.StartTransaction; // I GET, IN THIS LINE, THE ERROR "Cannot perform operation -- DB is not open"
>   with qTemp do
>   begin
>     Sql.Clear;
>     Sql.Add('DROP TABLE ' + TempTable);
>     ExecQuery;
> 
>     Sql.Clear;
>     Sql.Add('DROP TABLE ' + TempTable1);
>     ExecQuery;
>   end;
>   TValida.Commit;
> end;
> 
> So why this happens? Not always but sometimes it happens and the IBDatabase.Connected property is "True", I checked it.
> 
> Thanks

Nope, can't be true.  That message only appears in two spots (outside of 
events), one is in the connected property which checks if the FHandle is nil or 
not (which is exactly what IBTransaction.StartTransaction is calling and where 
you are getting that message).  The other place is in TIBDatabase's CheckActive 
which performs the exact same check, FHandle against nil.

Your database handle is somehow going to nil.

Also note if you have multiple databases on your transaction all of them must be 
active when you start a transaction (this is two phase commits) or else you get 
that message.



-- 
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
5/7/2015 5:04:24 PM
> {quote:title=quinn wildman wrote:}{quote}
> What version of Delphi?
> 
> Carlos Matos wrote:
> > Hi,
> > I know that IBX is not supported to work Firebird but this never happened until now, and so far IBX, for years, always worked impecable with Firebird.
> > So the problem is with this code:
> >
> > procedure TDMRecolha.DataModuleDestroy(Sender: TObject);
> > begin
> >    if TTemp.InTransaction then
> >      TTemp.RollBack;
> >    if TValida.InTransaction then
> >      TValida.RollBack;
> >    qFechaDocumento.FreeHandle;
> >    qFechaDocumento_Max.FreeHandle;
> >    qInsertMovimentoTemp.FreeHandle;
> >    qUpdateMovimentoTempB.FreeHandle;
> >    qUpdateMovimentoTemp_Publica.FreeHandle;
> >    qUpdateMovimentoTempBMapas.FreeHandle;
> >    qUpdateMovimentoTempC.FreeHandle;
> >    qDeleteMovimentoTemp.FreeHandle;
> >    qDeleteMovimentosTempDoTipo.FreeHandle;
> >    qDeleteTemp.FreeHandle;
> >    qUpdateTempDisplay.FreeHandle;
> >    qDeleteTempDisplay.FreeHandle;
> >    qInsertTempDisplay.FreeHandle;
> >    qUpdateSaldoTempDisplay.FreeHandle;
> >    qLerTotaisGeral.FreeHandle;
> >    qLerTotaisAnalitica.FreeHandle;
> >
> >    TValida.StartTransaction; // I GET, IN THIS LINE, THE ERROR "Cannot perform operation -- DB is not open"
> >    with qTemp do
> >    begin
> >      Sql.Clear;
> >      Sql.Add('DROP TABLE ' + TempTable);
> >      ExecQuery;
> >
> >      Sql.Clear;
> >      Sql.Add('DROP TABLE ' + TempTable1);
> >      ExecQuery;
> >    end;
> >    TValida.Commit;
> > end;
> >
> > So why this happens? Not always but sometimes it happens and the IBDatabase.Connected property is "True", I checked it.
> >
> > Thanks
> >

XE5 and also happens with XE8 trial
0
Carlos
5/11/2015 9:43:01 AM
> {quote:title=Jeff Overcash (TeamB) wrote:}{quote}
> Carlos Matos wrote:
> > Hi,
> > I know that IBX is not supported to work Firebird but this never happened until now, and so far IBX, for years, always worked impecable with Firebird.
> > So the problem is with this code:
> > 
> > procedure TDMRecolha.DataModuleDestroy(Sender: TObject);
> > begin
> >   if TTemp.InTransaction then
> >     TTemp.RollBack;
> >   if TValida.InTransaction then
> >     TValida.RollBack;
> >   qFechaDocumento.FreeHandle;
> >   qFechaDocumento_Max.FreeHandle;
> >   qInsertMovimentoTemp.FreeHandle;
> >   qUpdateMovimentoTempB.FreeHandle;
> >   qUpdateMovimentoTemp_Publica.FreeHandle;
> >   qUpdateMovimentoTempBMapas.FreeHandle;
> >   qUpdateMovimentoTempC.FreeHandle;
> >   qDeleteMovimentoTemp.FreeHandle;
> >   qDeleteMovimentosTempDoTipo.FreeHandle;
> >   qDeleteTemp.FreeHandle;
> >   qUpdateTempDisplay.FreeHandle;
> >   qDeleteTempDisplay.FreeHandle;
> >   qInsertTempDisplay.FreeHandle;
> >   qUpdateSaldoTempDisplay.FreeHandle;
> >   qLerTotaisGeral.FreeHandle;
> >   qLerTotaisAnalitica.FreeHandle;
> > 
> >   TValida.StartTransaction; // I GET, IN THIS LINE, THE ERROR "Cannot perform operation -- DB is not open"
> >   with qTemp do
> >   begin
> >     Sql.Clear;
> >     Sql.Add('DROP TABLE ' + TempTable);
> >     ExecQuery;
> > 
> >     Sql.Clear;
> >     Sql.Add('DROP TABLE ' + TempTable1);
> >     ExecQuery;
> >   end;
> >   TValida.Commit;
> > end;
> > 
> > So why this happens? Not always but sometimes it happens and the IBDatabase.Connected property is "True", I checked it.
> > 
> > Thanks
> 
> Nope, can't be true.  That message only appears in two spots (outside of 
> events), one is in the connected property which checks if the FHandle is nil or 
> not (which is exactly what IBTransaction.StartTransaction is calling and where 
> you are getting that message).  The other place is in TIBDatabase's CheckActive 
> which performs the exact same check, FHandle against nil.
> 
> Your database handle is somehow going to nil.
> 
> Also note if you have multiple databases on your transaction all of them must be 
> active when you start a transaction (this is two phase commits) or else you get 
> that message.
> 
> 
> 
> -- 
> 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)

Well Jeff, this is the line, at least for JCL Jedi Debug, where the error occurs.

And about multiple database, I only have one database working with that transaction.
0
Carlos
5/11/2015 2:17:40 PM
Reply:

Similar Artilces:

"Cannot perform this operation on an [open or closed] dataset"
I'm trying to do a simple Insert, Append, or AppendRecord() into the TADOTable table associated with my TDBGrid, but I get "Cannot perform this operation on an open dataset." If I close the dataset first, I get "Cannot perform this operation on a closed dataset." Shazam. I've tried everything -- all combinations of readonly's, open's, close's, and several séances, and can't get past this impediment. I'm using ADO and a small, simple Access mdb file ... help me, Obiwan ... procedure TForm1.Button1Click(Sender: TObject); begin a...

unable to open the Web <'website'>. You are not authorized to perform the current operation.
Hi everyone, When I try to copy web site from local to remote server with VS2005 Copy Web Site tool I got this message. "unable to open the Web <website>. You are not authorized to perform the current operation." I am administrator on both local and remote server which they are in the same network domain.Has anyone got any ideas how to fix this problem? Thanks in advance...  It may be that remote access is not enabled. On the server concerned, you need to go: Start All Programs Microsoft SQL Server 2005 Configuration Tools Sql Server Surface Are...

C++ Assignment Operator as the Delphi Implicit Operator
In C++ it is possible to use the operator= for assignment to the result type, the same as the implicit operator is used in Delphi. For instance, given the variable myVar with TValue type, in Delphi, it is possible to assign different types to this variable as follows: {code} a := 'assigning a string'; a := 123; a := 3.14; {code} Previously in C++, without the assignment operator, you had to write it like this: {code} a = TValue::_op_Implicit(UnicodeString(L"assigning a string")); a = TValue::_op_Implicit(123); a = TValue::_op_Implicit(3.14L); {code} Now in ...

"Open", "Open in new window", "Open in new tab" are greyed-out after drag&drop operation
Name: Dmitriy Email: dadotivanovathotmaildotcom Product: Firefox Release Candidate Summary: "Open", "Open in new window", "Open in new tab" are greyed-out after drag&drop operation Comments: Steps to Reproduce: 1. Drag&drop a bookmark from the Bookmarks Menu or Bookmarks Toolbar to the Tab bar. 2. Right-click on any bookmark (from the same folder, if darged from Menu, or from the visible part of Bookmarks Toolbar) Result: "Open", "Open in new window", "Open in new tab" are greyed-out Browser Details: Moz...

Delphi 2010 and Delphi XE5 shuts down when opening projects
Over the last week I have found it increasingly difficult to open projects. Even really simple projects, some more complex. For example if start Delphi 2010 Enterprise Edition. I see the list of recently opened projects. I then click on a simple existing project, I get a hour glass for about a second and then Delphi IDE has gone. In the windows task manager, there are now no applications running. I have not changed the installation, being using Delphi 2010 enterprise on the same computer for a few years. I'm not a full time developer, but do internal development of our compa...

Delphi 2010 and Delphi XE5 shuts down when opening projects
Over the last week I have found it increasingly difficult to open projects. Even really simple projects, some more complex. For example if start Delphi 2010 Enterprise Edition. I see the list of recently opened projects. I then click on a simple existing project, I get a hour glass for about a second and then Delphi IDE has gone. In the windows task manager, there are now no applications running. I have not changed the installation, being using Delphi 2010 enterprise on the same computer for a few years. I'm not a full time developer, but do internal development of our compa...

Stack overflow when opening a Delphi 7 frame in Delphi XE4
I am trying to port a Delphi 7 application to Delphi XE4. I have installed all the required component libraries in Delphi XE4 and I managed to open the Delphi 7 project in Delphi XE4. However, when I try to open one of the units containing a VCL frame I get the error "stack overflow - Save your work and restart RAD studio XE4". If I don't open any frames and try to build the project, the compiler can't find the components in the above mentioned frame unit and stops with an error. What should I do? Pier I figured out what the problem was. I has a TsiLang compo...

DBExpress terrible performance when migrating from Delphi 7 to Delphi 2007
Hi, When I'm migrating my project from Delphi 7 to Delphi 2007, I found that the speed slow down 3-4 times. I've started to investigate what is the reason of that and I've found that the problem is in the TSQLDataset component. So I make a simple example of an application that run one of my problem queries that fetches about 30000 rows and the result was amazing d7: 1500ms, d2007: 13500ms 8 times slower !!!! Here are some perameters of the TSQLConnection Delphi 7: object SQLConn: TSQLConnection ConnectionName = 'OracleConnection' DriverName = '...

Delphi and performance
Hello there, I have a massive performance Problem with Delphi. When I switch from the code to form view for the first time, it takes about 5 minutes until the form shows up. When I try to filter the component palette, it takes about 2 seconds for one character to appear. Has anyone else some similar issues? Now My Configuration: Software: - Windows 7 Ultimate 64Bit English - Delphi 2010 Enterprise English Hardware: - Intel Quad Core QX9300 @ 2,51 Ghz - 8 GB RAM - 128GB SSD All oher Programs seen to run fine, but as soon as I am starting Delphi, one of the Cores is permanent...

CA operations
On both a new and existing install of iManager 2.6, attempting some operations on CA object, result in "Internal error" "page has peformed an illegal operation" For example, in iManager, Directory Administration, Modify Object, clicking on Certificates tab will give the error. This is in prep to move the CA to a Linux box. FWIW following TID 3618399. I have full admin rights. PKIdiag on CA server (NW6.5) shows 0 errors. Searching KB give no clues. -- joea ------------------------------------------------------------------------ joea, You ...

Opening up a PAS file opens up another instance of Delphi XE IDE... [Edit]
Here's the problem: When I double click on a .Pas file. a new Delphi XE IDE opens up. Is there a way to open up the file inside of the Delphi XE IDE that is currently open? Edited by: Joseph Trapani on Jan 31, 2012 4:04 PM > Here's the problem: > When I double click on a .Pas file. a new Delphi XE IDE opens up. > Is there a way to open up the file inside of the Delphi XE IDE that is > currently open? > > Edited by: Joseph Trapani on Jan 31, 2012 4:04 PM Drag and drop the file onto the IDE? BTW: I have my .PAS files set to open in a text editor ...

Can I perform a minus operation between two result sets, like oracle's MINUS operator?
Hi! For example: Two result sets: A and B. I want a new set : A-B Thank you! AFAIK there are two ways to do this in ASE: (1) Load A into a temporary table and delete from it via a join with B. (2) Select A.STUFF into DIFFERENCE from A where not exists (select B.key1 from B where B.key1 = A.key1 and B.key2 = A.key2 ....) The second technique may be slow owing to the "not exists". "From East" ...

Unable to open the physical file. Operating system error 5: "5(Access is denied.)". A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
PLEASE TELL ME A SOLUTION.... Server Error in '/PS' Application. The '/PS' is virtual directory of Local Host.Unable to open the physical file "G:\Personal Site Kit\App_Data\personal.mdf". Operating system error 5: "5(Access is denied.)".An attempt to attach an auto-named database for file G:\Personal Site Kit\App_Data\personal.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. Description: An unhandled exception occurred during the execution of the current web request. Please review th...

Window opening performance
This is a multi-part message in MIME format. --------------060003000204020008060002 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit I thought I'd write down what thoughts I have on window opening performance. First of all, we have a problem with it. Ignoring metrics and all that, it's just slow. Even on pretty modern hardware opening a window shows appreciable lag. If we look at the metrics, https://bugzilla.mozilla.org/show_bug.cgi?id=372637 has some numbers from back in May that show that we're a good bit slower than Fire...

The requested operation cannot be performed...
hi can someone please tell me what can cause such a problem? "The requested operation cannot be performed on a file with a user-mapped section open." it happens (not all the time) when i try to save the content of a stream to a file thanks The file is being opened by your/other process. Use unlocker to get the process that lock your file. > {quote:title=pure A wrote:}{quote} > The file is being opened by your/other process. Use unlocker to get the process that lock your file. unlocker is a stand alone application, i cant use it inside my code :) when trying to ...

Web resources about - Cannot perform operation -- DB is not open - embarcadero.delphi.interbase

United States Special Operations Command - Wikipedia, the free encyclopedia
The United States Special Operations Command ( USSOCOM ) is the Unified Combatant Command charged with overseeing the various Special Operations ...

Cameroon army frees 900 Boko Haram hostages in military operation: defence ministry
Cameroon's army, backed up by a regional task force, has killed at least 100 members of the militant Islamist Boko Haram group and freed 900 ...

Canberra family spreads Christmas cheer with Operation Christmas Spirit
It was a small gesture, but the generous family didn't realise just how big an impact they had.

Passenger flights to resume operations from Chennai airport today
... airport authorities here have received requests from national carrier Air India to operate flights today after the AAI announced day-time operations ...

Carfax to expand Fairfax County headquarters, other Virginia operations
... to expand its headquarters in Fairfax County, Virginia, creat The company also will invest $10.8 million to upgrade its data center operation ...

900 Boko Haram hostages freed in multinational operation
CBS News 900 Boko Haram hostages freed in multinational operation CBS News YAOUNDE, Cameroon A multinational force freed 900 hostages held ...

Micron closing Puerto Rico operation, shifts work to China
Semiconductor maker Micron Technology is closing a manufacturing facility in Puerto Rico and moving the work to China. Around 185 jobs are affected ...

Carter: US Special Forces Deploying To Conduct ‘Unilateral Operations in Syria’
Carter: US Special Forces Deploying To Conduct ‘Unilateral Operations in Syria’

Defense Secretary Carter announces more U.S. special operations personnel will be sent to Syria
... troops acting as trainers and advisers in Iraq, but supposedly not engaging in combat, the U.S. now is sending or has sent 50 special operations ...

NXP Says Freescale Will Boost Operations in IoT, Connected Cars
With the $12 billion deal complete, NXP executives expect the combined company to be number one in such areas as automotive and identification ...

Resources last updated: 12/9/2015 4:28:18 AM