Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
Unable to DROP DATABASE - Error 300 |
Wed, May 28 2008 8:13 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | As part of my query generator I've written an editor for the settings. On creating the form I create an im-memory database to use, and I'm trying to drop it when the form is closed.
I'm getting error 300 - can't lock the database for exclusive access. As you can see below I've closed all the tables and queries I'm using but still no joy. Is there any way I can find out what is stopping this action. procedure TnlhSQGEdFrm.FormClose(Sender: TObject; var Action: TCloseAction); begin UsedFields.Free; infFld.Close; infTbl.Close; FldMaker.Close; FldDropper.Close; xRefTbl.Close; xRefFld.Close; fldDropper.Close; DBMaker.Close; // try DBMaker.SQL.Text := 'DROP DATABASE "SQGSettings"'; DBMaker.ExecSQL; // except // end; end; Roy Lambert |
Wed, May 28 2008 12:05 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< As part of my query generator I've written an editor for the settings. On creating the form I create an im-memory database to use, and I'm trying to drop it when the form is closed. I'm getting error 300 - can't lock the database for exclusive access. As you can see below I've closed all the tables and queries I'm using but still no joy. Is there any way I can find out what is stopping this action. >> You need to make sure that any TEDBDatabase components that reference that database are closed, not just the tables and queries. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, May 28 2008 2:19 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Finally tracked it down. Moved the create/drop into the verb procedure TnlhSQGSettingsEditor.ExecuteVerb(Index: integer); var EdFrm: TnlhSQGEdFrm; begin if TnlhSQGSettings(Component).Session <> nil then begin try TnlhSQGSettings(Component).Session.Execute('CREATE DATABASE "dbSQG" IN MEMORY'); except end; EdFrm := TnlhSQGEdFrm.Create(Application); EdFrm.SQGSettings.CloneFrom(TnlhSQGSettings(Component)); EdFrm.SQGSettings.Session := TnlhSQGSettings(Component).Session; if EdFrm.ShowModal = mrOK then TnlhSQGSettings(Component).CloneFrom(EdFrm.SQGSettings); EdFrm.Free; try TnlhSQGSettings(Component).Session.Close; <<<<<<<<<<<<<<<<<<<<<<<<<<< This is what I finally tracked down as needed TnlhSQGSettings(Component).Session.Execute('DROP DATABASE "dbSQG"'); TnlhSQGSettings(Component).Session.Close; except end; Designer.Modified; end else MessageDlg('A session MUST be assigned before calling the editor', mtWarning, [mbOK], 0); end; Amongst the other trivial tasks you have is there a possibility of the error messages giving a bit more detailed pointer as to the problem? Roy Lambert |
Thu, May 29 2008 12:20 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Finally tracked it down. >> Yes, you must close the session if the TEDBSession.KeepConnections property is set to True, or alternately you can call this method: http://www.elevatesoft.com/manual?action=mancompmethod&id=edb1&product=d&version=7&comp=TEDBSession&method=DropConnections Temporary database objects are created and kept around when you don't refer to an actual TEDBDatabase in a TEDBTable, TEDBQuery, etc. 's DatabaseName property, but rather use the actual database name. In such a case, EDB creates a hidden and temporary TEDBDatabase component that is used instead. -- Tim Young Elevate Software www.elevatesoft.com |
Thu, May 29 2008 2:04 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>Temporary database objects are created and kept around when you don't refer >to an actual TEDBDatabase in a TEDBTable, TEDBQuery, etc. 's DatabaseName >property, but rather use the actual database name. In such a case, EDB >creates a hidden and temporary TEDBDatabase component that is used instead. No wonder I couldn't see it then - I thought I was going blind Roy Lambert |
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |