Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 11 total |
How to share Config file on network drive for local db? |
Thu, Aug 30 2012 12:39 PM | Permanent Link |
Barry | I'm a little confused as how to share the same EDB v2.09 Config file and database between a VirtualBox that uses a network drive letter (Fto point to drive (Don the local machine. So the Virtualbox stores the database outside of the virtualbox and uses the network drive F:, which is in fact the machine's local drive D: (outside of the virtualbox).
The local machine's EDB Config directory is D:\Data\MyProj and the data is stored in D:\Data\MyProj\Data. So if my program runs on the local machine it uses the config file in D:\Data\MyProj and the database is in D:\Data\MyProj\Data. The VirtualBox sees the same set of files as F:\Data\MyProj and F:\Data\MyProj\Data. I can easily use a parameter to my program to tell it which Config directory to use. But how do I tell the config file to look for the database in D:\Data\MyProj\Data or F:\Data\MyProj\Data? It seems to me the database directory is hard coded into the Config files and I have to use EDBMgr to change the drive letter of the database directory depending on whether I am running the application from inside the vbox or not. Is there a simple way around this? Can I specify a Database folder that is relative to the Config folder? Also, how do you get around this problem when installing an application on the user's machine, where he could specify any directory for the config file or database location? Is this explained in the documentation somewhere? TIA Barry v2.09 Delphi XE2 |
Thu, Aug 30 2012 12:54 PM | Permanent Link |
Terry Swiers | Barry,
> Is there a simple way around this? Share the D:\Data\MyProj and use UNC paths. So if the host system is named VBoxHost and you share that folder as MyProj, you would point to \\VBoxHost\MyProj for the config file and the database entry would point to \\VBoxHost\MyProj\Data . With this naming convention, it doesn't matter if you are accessing the config and data from the local system or from a VirtualBox instance as the path is the same. --------------------------------------- Terry Swiers Millennium Software, Inc. http://www.1000years.com http://www.atrex.com --------------------------------------- |
Fri, Aug 31 2012 12:02 AM | Permanent Link |
Barry | Terry,
That worked, thanks. So when I install my application on a user's machine, how do I change the Cfg file using Delphi code to point to the user's directory and database directory? I'm using EDBMgr at the moment for my own computer, but of course the user won't have access to it. Barry |
Fri, Aug 31 2012 7:32 AM | Permanent Link |
Adam Brett Orixa Systems | >>So when I install my application on a user's machine, how do I change the Cfg file using Delphi code to point to the >>user's directory and database directory?
Not sure I understand your question, the EDBSession variable includes a config path, so if you're working locally you can use that property. Otherwise if you are working with the EBDSRVR I tend to: * start with a EDBBkp file with the DB I want to install & copy this into a path on the users machine. * run a script which RESTOREs, the db creates sessions etc. These steps can be done manually within EDBMgr, or with a separate delphi exe. Adam |
Sat, Sep 1 2012 8:29 PM | Permanent Link |
Barry | Adam,
The Config file has an entry that points to the Database Folder. How can I change the location of this Database Folder using Delphi code (instead of using EDBMgr)? TIA Barry |
Sun, Sep 2 2012 6:41 AM | Permanent Link |
Uli Becker | Barry,
> The Config file has an entry that points to the Database Folder. How can I change the location of this Database Folder using Delphi code (instead of using EDBMgr)? Just execute a query like this (databasename = CONFIGURATION) with ConfigurationQuery do begin close; sql.Text := 'select * from Databases where Name = ''MyDatabase'''; open; if recordcount = 0 then begin close; sql.Text := 'create database "Quickstart" path ' + Engine.QuotedSQLStr(MyDataPath); ExecSQL; { Script that creates all tables or just copy the catalog } CreateDatabaseScript.ExecScript; end else begin close; sql.Text := 'alter database "MyDatabase" path ' + Engine.QuotedSQLStr(MyDataPath); ExecSQL; end; end; Uli |
Sun, Sep 2 2012 11:37 AM | Permanent Link |
Fernando Dias Team Elevate | Barry,
You can do that using SQL, either as in Uli's example using TQuery, or by using TEDBSession.Execute method: EDBSession1.Execute('ALTER DATABASE "MyDataBase" PATH 'D:\MyEDBData\NewFolder'); Please note that this statement changes the path, but it doesn't move the database files to the new folder. -- Fernando Dias [Team Elevate] |
Mon, Sep 3 2012 2:39 AM | Permanent Link |
Ralf Bieber EDV Dienstleistungen Ralf Bieber | Fernando Dias wrote:
> Barry, > > You can do that using SQL, either as in Uli's example using TQuery, > or by using TEDBSession.Execute method: > > EDBSession1.Execute('ALTER DATABASE "MyDataBase" PATH > 'D:\MyEDBData\NewFolder'); > > Please note that this statement changes the path, but it doesn't move > the database files to the new folder. Hello, A minimal addition: " .. Build 14 of the 2.03 version of ElevateDB has a breaking change in it for the use of relative paths in the CREATE DATABASE/ALTER DATABASE statements. If you specify a relative path for an on-disk database, it will now be interpreted as a path relative to the configuration file path, not relative to the current working directory for the operating system. .." With a structure like this: D:\..\MyEDBDate_Configfilepath\MyProject\DataBase You can use this: Engine.UseLocalSessionEngineSettings :=true; MySession.LocalConfigPath :='D:\..\MyEDBDate_Configfilepath\'; EDBSession1.Execute('ALTER DATABASE "MyDataBase" PATH 'MyProject\DataBase'); This make the handling of the a little bit simpler. |
Wed, Sep 5 2012 11:06 AM | Permanent Link |
Barry | Ralf, Fernando, Ulrich, et al,
Thanks for the suggestions. I didn't realize there was an "Alter Database ... Path" command. That was the missing piece I was looking for. Barry |
Wed, Sep 5 2012 9:29 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Barry,
<< Can I specify a Database folder that is relative to the Config folder? >> Yes, you can simply define the database path as "Data", and as long as the configuration path for each machine points to the directory right above the "Data" directory, EDB will find the database just fine. Terry's answer is spot-on for specifying the configuration path. If you have any other questions, please let me know. Tim Young Elevate Software www.elevatesoft.com |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, May 7, 2024 at 06:25 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |