Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FireDAC + FB connection at client site.



Permlink Replies: 1 - Last Post: Mar 4, 2018 11:59 PM Last Post By: Robert Triest
Noor Ahmad Fero...

Posts: 1
Registered: 12/8/17
FireDAC + FB connection at client site.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 4, 2018 1:06 AM
Hi,

I am using firedac to connect to firebird database located at application folder, everything works fine. But when I deploy the application to client's PC I can't open the application and it gives following error:

[FireDAC][Phys][FB]I/O error during "CreateFile (open)" operation for file "file location"
Errir while trying to open file.
The system cannot find the path specified.

I have following code for before connect event of the connection

with MainConnection do
    begin
 
      Params.DriverID := Options.DriverID;
      Params.Database := Options.Database;
      Params.UserName := Options.User_Name;
      Params.Password := Options.Password;
      Params.Add('CharacterSet=utf8');
      // ResourceOptions.BackupFolder := GetCurrentDir + 'Backup\';
 
      LoginPrompt := False;
      Connected := True;
 
    end;

Options.Database fetchs the firebird database file location from root directory
GetCurrentDir + '\xDB.FDB';
.

I am using Delphi 10.1 and FireBird 3.

Thanks,
Robert Triest

Posts: 687
Registered: 3/24/05
Re: FireDAC + FB connection at client site.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 4, 2018 11:59 PM   in response to: Noor Ahmad Fero... in response to: Noor Ahmad Fero...
GetCurrentDir is the last opened Dir of a procerss in Windows by the user.
"retrieves the current directory for the current process"
At first it will be the App dir but as soon you open/save something in the application
with a open/save dialog the GetCurrentDir will change.

If you need the Dir of the application you can use:
//Including the last slash
Path:= ExtractFilePath(Application.ExeName);
//or without last slash
AppDir := ExtractFileDir(Application.ExeName);
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02