Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Using DBISAM as part of a WebService
Wed, Aug 26 2009 3:27 AMPermanent Link

Jonathan Mackey
I have recently migrated our current software from a desktop-based platform to a
WebService.  I had a problem a while back connecting to the database, I got around that by
using this code:

 [code]

   session.PrivateDir := GetCurrentDir + '\DB';

   tblSingleApplicant := TDBISAMTable.Create(nil);
   dsSingleApplicant := TDataSource.Create(nil);
   qrySingleApplicant := TDBISAMQuery.Create(nil);

   tblSingleApplicant.DatabaseName := 'DB';
   tblSingleApplicant.TableName := 'App.DAT';

   dsSingleApplicant.DataSet := tblSingleApplicant;
   qrySingleApplicant.DataSource := dsSingleApplicant;
   qrySingleApplicant.DatabaseName := 'DB';

 [/code]

This works for desktop applications, but when I try to do this running it as a WebService
it tells me that it cannot find DB\App.DAT.  I'm hoping that someone here can shed some
light on what I'm doing wrong!  I'm running IIS7 and the DB folder is in the same folder
as the dll.

Many thanks,

Jonathan
Wed, Aug 26 2009 5:57 AMPermanent Link

"Eduardo [HPro]"
Jonathan

If database information share the folder with DLL, then I will not use C/S
approach.
Instead of I will use something like below:

Database := TDBISamDatabase.Create(nil);
Database.DatabaseName := 'DB';
Database.Directory := 'c:\mydata';

And the other things stay in the same way.

Eduardo

Wed, Aug 26 2009 11:55 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jonathan,

<< This works for desktop applications, but when I try to do this running it
as a WebService it tells me that it cannot find DB\App.DAT.  I'm hoping that
someone here can shed some light on what I'm doing wrong!  I'm running IIS7
and the DB folder is in the same folder as the dll. >>

You're probably going to need to use a full path name, or at least make sure
to set the current working directory (SetCurrentDir function in Delphi) at
the start of the web service if you want to use a relative path for the
database directory.  Relative paths can be tricky due to the web server
changing the current working directory during operation.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image