Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 10 total
Thread Problem opening Table
Thu, Aug 20 2009 2:41 AMPermanent Link

"Adam H."
Hi,

I'm trying to run our first EDB application on a new computer (not my
development machine) and am having a problem I can't figure out.

When the application starts I set the sessions LocalConfigPath, and the
Engine's Config path before activating them both. (These two properties are
set to the same directory).

I can set these, and activate both components fine. The next thing I try and
do is open up a TEDBTable on a separate form, and it crashes with the error
below. (Strangely, it's still trying to access the directory in the IDE
instead of taking on the 'new' values).

---------------------------------------------
ElevateDB Error #600 File manager error (Cannot create file
p:\myclient\myapp\database\data\MyDatabase.EDBCat (OS Error: The system
cannot find the path specified.))
---------------------------------------------

I have confirmed via code that the values are actually changed (here is an
extract of my code) - so I don't know what's causing this.

---------------------------------------------
formmain.DBS.connected := false;
FormMain.EDBEngine1.ConfigPath := DBDirectory.text;
formmain.DBS.LocalConfigPath := DBDirectory.text;
showmessage('Updated the EDB Config Path.' + #13#10#13#10+ 'Path is: ' +
FormMain.DBS.LocalConfigPath);
showmessage('Activating Engine');
formmain.EDBEngine1.Active := true;
showmessage('Activating Session ' + FormMain.DBS.LocalConfigPath);
formmain.DBS.connected := true;
showmessage('Session activeated');
formmain.dbs.connected := true;
formsetup.SetupT.open; //ERRORS HERE<<<<<<<<<
---------------------------------------------

I thought that maybe the session or database properties on the EDBTable may
not have been set, but they are both set - so I'm at a bit of a loss as to
why I'm getting the error when I try and open the table.

Does anyone have any ideas what may be causing this?

Thanks & Regards

Adam.
Thu, Aug 20 2009 3:11 AMPermanent Link

"Adam H."
Hi Guys,

I think I've found the problem. (And it's not within my code).

We copied the database directory and files onto the new computer, but the
database config file still has the "database folder" set to the location on
our development machine.

With this being the case, what is the preferred method when moving a
database. (ie, in DBISam, we simply just had to copy the data to a new
location, and tell our application where the new data is). It would appear
now we have a bit more to do (such as if we move the database, we need to
run up EDBManager and set the database folder to the new location / path.

Is there a way to make it so our application handles all of this, or am I
trying to work with EDB the wrong way?

Thanks & Regards

Adam.
Thu, Aug 20 2009 3:30 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


You'll have to issue an ALTER DATABASE command to point to the new data directory

Roy Lambert [Team Elevate]
Thu, Aug 20 2009 8:02 PMPermanent Link

"Adam H."
Good Morning Roy,

> You'll have to issue an ALTER DATABASE command to point to the new data
> directory

Thanks for that. I've changed my code to the following:

formmain.DBS.connected := false;
formmain.DBS.LocalConfigPath := DBDirectory.text;
try
formmain.EDBEngine1.Active := true;
formmain.DBS.connected := true;
except
// we're unable to update the path......
beeperror;
 showmessage('Error accessing database '+
#13#10+Exception(ExceptObject).Message);
end;
end;

try
formsetup.SetupT.open; //See if we can open
except //we have a problem here... - looks like the database needs to be
altered
FormMain.DB.Connected := False;
formmain.DBS.execute('ALTER DATABASE "CBData" PATH
'+quotedstr(DBDirectory.Text + '\data'));
showmessage('Just alteredtable');
 end;


So, in my code I've attempted to open the database, and if it fails, I've
called an alter database command to point to the new location.

Does this mean that every machine that is connecting to the database has to
have the same path. (ie, if one machine has a mapped network path of drive
P:, and another one has a mapped network path of drive S: pointing to the
same location, it will fail - because the paths have to be identical for
each machine?

Sorry for all the questions - I just want to make sure I start off on the
right foot.

Cheers

Adam.
Fri, Aug 21 2009 3:27 AMPermanent Link

Uli Becker
Adam

> formmain.DBS.connected := false;
> formmain.DBS.LocalConfigPath := DBDirectory.text;

I you want to use the "LocalConfigPath" of the session, then you have to set

UseLocalEngineSettings := true

of the Engine. Otherwise the path in "ConfigPath" will be valid.

Uli
Fri, Aug 21 2009 3:59 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Adam


Use UNC. You can no longer just find a convenient way to point to the data it has to be consistent over all users.

Tim wrote a damn good response as to why this is so in another ng - I'll let you find it

Roy Lambert [Team Elevate]
Fri, Aug 21 2009 11:21 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Adam,

<< Does this mean that every machine that is connecting to the database has
to have the same path. (ie, if one machine has a mapped network path of
drive P:, and another one has a mapped network path of drive S: pointing to
the same location, it will fail - because the paths have to be identical for
each machine? >>

Yes.  See this thread for more information on this:

http://www.elevatesoft.com/newsgrp?action=openmsg&group=16&msg=1765&page=1#msg1765

--
Tim Young
Elevate Software
www.elevatesoft.com

Sun, Aug 23 2009 10:01 PMPermanent Link

"Adam H."
Good Morning Uli,
>> formmain.DBS.connected := false;
>> formmain.DBS.LocalConfigPath := DBDirectory.text;
>
> I you want to use the "LocalConfigPath" of the session, then you have to
> set
>
> UseLocalEngineSettings := true
>
> of the Engine. Otherwise the path in "ConfigPath" will be valid.

Do you mean
UseLocalEngineSessionSettings := true;

If so... got that covered, but thanks for the heads up.

Adam.
Sun, Aug 23 2009 10:02 PMPermanent Link

"Adam H."
Hi Roy,

> Use UNC. You can no longer just find a convenient way to point to the data
> it has to be consistent over all users.

OK - no sweat. Thanks for that. Just wanted to confirm (as it was something
I first missed).

Cheers

Adam.
Sun, Aug 23 2009 10:02 PMPermanent Link

"Adam H."

"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote in message
news:DBC89500-C2B8-43D5-A5B4-664329D0E423@news.elevatesoft.com...

> Yes.  See this thread for more information on this:
<snip>

Thanks Tim!

Cheers

Adam.
Image