Board index » delphi » Can't create new alias for an Interbase table

Can't create new alias for an Interbase table

I am having problems creating an alias for an existing Interbase .gdb file.
I have done it fine for a Paradox database but can't get it quite right. The
new alias does appear when i check in the BDE Administrator but the path to
the file is not there. I just have IB_SERVER:/PATH/DATABASE.GDB where the
real path name should be. This is the code i am using. sFileName is the full
file path returned from an Open Dialog box. sAliasName is 'TestSQL'.

procedure TForm1.CreateNewSQLAlias(sAliasName, sFileName: string);
var
   MyList : TStringList;
begin
   MyList := TStringList.Create;
   try
      MyList.Add(sFileName);
      MainSession.AddAlias(sAliasName, 'INTRBASE', MyList);
   finally
      MyList.Free;
   end;
end;

What am i doing wrong ?

 

Re:Can't create new alias for an Interbase table


I don't know what values are passed through your parameters, but did you
test the example on your delphi help?
Seems like you did, but you might need more input to MyList. Such as
password and/or page size. I'm not sure, don't have time to test it yet.

This example creates an alias for an InterBase database server:

var

  MyList: TStringList;
begin
  MyList := TStringList.Create;
  try
    with MyList do
    begin
      Add('SERVER NAME=IB_SERVER:/PATH/DATABASE.GDB');
      Add('USER NAME=MYNAME');
    end;
    Session1.AddAlias('NewIBAlias', 'INTRBASE', MyList);
  finally
    MyList.Free;
  end;
end;

"John" <john.shobbr...@btinternet.com> skrev i melding
news:3a9cdc3f_2@dnews...

Quote
> I am having problems creating an alias for an existing Interbase .gdb
file.
> I have done it fine for a Paradox database but can't get it quite right.
The
> new alias does appear when i check in the BDE Administrator but the path
to
> the file is not there. I just have IB_SERVER:/PATH/DATABASE.GDB where the
> real path name should be. This is the code i am using. sFileName is the
full
> file path returned from an Open Dialog box. sAliasName is 'TestSQL'.

> procedure TForm1.CreateNewSQLAlias(sAliasName, sFileName: string);
> var
>    MyList : TStringList;
> begin
>    MyList := TStringList.Create;
>    try
>       MyList.Add(sFileName);
>       MainSession.AddAlias(sAliasName, 'INTRBASE', MyList);
>    finally
>       MyList.Free;
>    end;
> end;

> What am i doing wrong ?

Re:Can't create new alias for an Interbase table


Quote
> Seems like you did, but you might need more input to MyList. Such as
> password and/or page size. I'm not sure, don't have time to test it yet.

>     with MyList do
>     begin
>       Add('SERVER NAME=IB_SERVER:/' + 'C:\Data\Testfile.gdb');
>       Add('USER NAME=JOHN');
>     end;

Even with this code i can't get it to work. I am not sure if the first item
in MyList is correct. How do i create an alias if the location of the .gdb
file is 'C:\Data\Testfile.gdb' ?
Thanks for your response
John

Re:Can't create new alias for an Interbase table


Assuming you are using TCP/IP the correct path syntax is:

Add('SERVER NAME=IB_SERVER:C:\Data\Testfile.gdb');

--
Bill

Re:Can't create new alias for an Interbase table


Quote
> Assuming you are using TCP/IP the correct path syntax is:

> Add('SERVER NAME=IB_SERVER:C:\Data\Testfile.gdb');

No that didn't work. I am trying to make the alias of the database file,
where the Interbase Server / the Database file and the program (trying to
make the alias) are on the same machine.
Any other ideas ?

Re:Can't create new alias for an Interbase table


In that case

SERVER NAME=C:\Data\Testfile.gdb

is all you need.

--
Bill

Re:Can't create new alias for an Interbase table


That's it.
Thanks very much indeed  Bill
John

Bill Todd (TeamB) <billtodd...@nospam.qwest.net> wrote in message
news:3a9eb7ea$1_1@dnews...

Quote
> In that case

> SERVER NAME=C:\Data\Testfile.gdb

> is all you need.

> --
> Bill

Other Threads