Board index » off-topic » Mapped drive path to BDE path

Mapped drive path to BDE path


2004-07-13 09:58:38 PM
off-topic17
Is there a way to convert a path which contains
a mapped drive to full path which BDE can use:
MappedDrive:\path -><serverName>:<drive>:\path
Much obliged.
Meursault.
 
 

Re:Mapped drive path to BDE path

See:
ExpandUNCFileName
in sysutils.pas
(I'm still on Delphi 5, but this should still be there).
 

Re:Mapped drive path to BDE path

"C P" < XXXX@XXXXX.COM >wrote:
Quote
See:

ExpandUNCFileName

in sysutils.pas

(I'm still on Delphi 5, but this should still be there).
BDE can't work with UNC format.
I need explicit path with no sharings.
 

{smallsort}

Re:Mapped drive path to BDE path

"Bill Todd (TeamB)" < XXXX@XXXXX.COM >wrote:
Quote
On 14 Jul 2004 03:41:23 -0700, "Meursault" < XXXX@XXXXX.COM >
wrote:
The BDE works fine with UNC paths.
I read the article and still can't make
bde connect to interbase db.
I'm 100% sure that my UNC path is correct.
What am I missing here?
 

Re:Mapped drive path to BDE path

"Bill Todd (TeamB)" < XXXX@XXXXX.COM >wrote:
Quote
Interbase does not support UNC paths. This is what happens
when you do not provide enough information with your
question. I guessed that you were using Paradox tables. :)
Yes. I thought the problem is with BDE not Interbase.
Quote
Assuming you are connecting to IB using TCP/IP the connection>string needs to be:
ServerName:c:\mydb\somedb.ib
So, back to my original question. :)
Is there a way to translate mapped drive path to
the path formed in a way mentioned above?
Or where should I post this question?
Thanks.
 

Re:Mapped drive path to BDE path

Hi there,
I know exactly what you are battling with. Here's some code I use to convert
a UNC path to the correct form.
procedure TfrmSettings.sbVerifyDBClick(Sender: TObject);
var sDatabasePath, sFinalPath: string;
iPosSlash: Integer;
begin
try
if Pos('\\', eDatabasePath.Text)>0 then begin
sDatabasePath := eDatabasePath.Text;
Delete(sDataBasePath,1,2);
iPosSlash := Pos('\',sDataBasePath);
sFinalPath := Copy(sDataBasePath,1,iPosSlash-1)+':';
Delete(sDataBasePath,1,iPosSlash);
iPosSlash := Pos('\',sDataBasePath);
sFinalPath := sFinalPath+Copy(sDataBasePath,1,iPosSlash-1)+':';
Delete(sDataBasePath,1,iPosSlash);
sFinalPath := sFinalPath+sDataBasePath;
eDatabasePath.Text := sFinalPath;
end;
ConMainCheck.Connected := False;
ConMainCheck.DatabaseName := eDataBasePath.Text;
ConMainCheck.Params.Add('user_name='+Trim(eUserID.Text));
ConMainCheck.Params.Add('password='+Trim(ePassword.Text));
ConMainCheck.LoginPrompt := False;
ConMainCheck.Connected := True;
MessageDlg('Database connection verified.',mtInformation,[mbOK],0);
sbAcceptDB.Enabled := True;
except
on E:Exception do begin
MessageDlg('Error connecting to database:
'+E.Message,mtError,[mbOK],0);
end;
end;
end;
It very simply assumes that if the path string to the db file commences with
\\ then it is a unc path, and it forms the path correctly.
If the user is navigating to the db file, and does not use a UNC path, then
of course this code will not work unless you use the ExpandUNCPath function
in sysutils to create the UNC path before forming it using the above code.
Hope this helps.
Regards,
Morpheus
"Meursault" < XXXX@XXXXX.COM >wrote in message
Quote

"Bill Todd (TeamB)" < XXXX@XXXXX.COM >wrote:
>Interbase does not support UNC paths. This is what happens
>when you do not provide enough information with your
>question. I guessed that you were using Paradox tables. :)

Yes. I thought the problem is with BDE not Interbase.

>Assuming you are connecting to IB using TCP/IP the connection>string
needs to be:

>ServerName:c:\mydb\somedb.ib

So, back to my original question. :)
Is there a way to translate mapped drive path to
the path formed in a way mentioned above?

Or where should I post this question?

Thanks.