Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 11 to 17 of 17 total |
Best Way to Alter Database Path. |
Thu, May 10 2018 7:38 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Steve
I just tried here using EDBManager 2.28b1. Click on the session, click on a database to see where it is now (I used one of my junk databases) then bunged the sql in ALTER DATABASE "Test2" PATH 'Z:\Zap' Result - an error 300 Move back up to the session - disconnect session then connect session tried the sql again and ..... perfect result. Looking down at the status line I see that I've moved from the Configuration database to Test2 ie the database is open (or at least selected). Without trawling through EDBManager's code I'd guess that Tim specifically closes/disconnects the database or session before executing the statement. Try the above and if it works then somewhere somehow the database is open and you might want to try explicitly closing / disconnecting DBSession before DBSession.Execute(SQL); If that doesn't work can you post the actual code you're using please. Roy Lambert |
Thu, May 10 2018 9:02 AM | Permanent Link |
Steve Gill | Hi Adam,
<< Is it possible instead to create a second database at the new location, backup the existing one, restore it to the new location, then close the session, and change its path to the new location. You end up with 2 copies of the database, one at the new location that the user wants. Once the new database is set up, you can delete the old one. >> Thanks. That's a good idea. = Steve |
Thu, May 10 2018 9:16 AM | Permanent Link |
Steve Gill | Hi Roy,
<< I just tried here using EDBManager 2.28b1. Click on the session, click on a database to see where it is now (I used one of my junk databases) then bunged the sql in ALTER DATABASE "Test2" PATH 'Z:\Zap' Result - an error 300 Move back up to the session - disconnect session then connect session tried the sql again and ..... perfect result. Looking down at the status line I see that I've moved from the Configuration database to Test2 ie the database is open (or at least selected). Without trawling through EDBManager's code I'd guess that Tim specifically closes/disconnects the database or session before executing the statement. Try the above and if it works then somewhere somehow the database is open and you might want to try explicitly closing / disconnecting DBSession before DBSession.Execute(SQL); If that doesn't work can you post the actual code you're using please. >> Thanks for the suggestions. I managed to get it working. Before executing the SQL to change the code there is a query that retrieves the current database path. It is then compared to the "new" path and if they're not the same then the database is altered to use the new path. Now there was a line to explicitly close the TEDBDatabase object before executing the alter path SQL but the error was still occurring. So I deleted the TEDBDatabase and TEDBQuery objects and instead created them dynamically to the the existing path and then destroyed them. The alter path SQL was then executed from the TEDBSession object. Problem solved. So it seems that when I had the TEDBDatabase object on the datamodule and closed it, the lock was somehow still there. Anyway, it's all working now. I'm grateful to everyone for all of the suggestions. = Steve |
Thu, May 10 2018 10:45 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Steve
In your session component is your KeepConnections property set to True? Roy Lambert |
Thu, May 10 2018 5:30 PM | Permanent Link |
Steve Gill | Hi Roy,
<< In your session component is your KeepConnections property set to True? >> As a matter of fact it is. Hadn't thought of that. = Steve |
Fri, May 11 2018 2:34 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Steve
><< In your session component is your KeepConnections property set to True? >> > >As a matter of fact it is. Hadn't thought of that. And another little tip is not to involve the database at all. Have a look at the result of select * from databases when a query is executed from the configuration database. Configuration is session level as is Information so you can get a slew of information without ever opening the database. Roy |
Mon, May 14 2018 6:58 PM | Permanent Link |
Steve Gill | << Configuration is session level as is Information so you can get a slew of information without ever opening the database. >>
Thanks Roy, I'd forgotten about that. = Steve |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Monday, April 29, 2024 at 05:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |