Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BDE Alias through Delphi 1

Status
Not open for further replies.

ManojKG

Programmer
Sep 30, 2002
6
IN
hello,


Instead of manually creating BDE alias through BDE ,
How to create a BDE alias through Delphi codeing
I am using ORACLE in backend.

Plz help me

Manoj
 
I could have sworn someone wrote an FAQ on that, but I don't see it in that section.

We code it like this for paradox:

If Session.IsAlias('AliasXYZ') then
Session.DeleteAlias('AliasXYZ');
Session.AddStandardAlias('AliasXYZ','C:\XYZ','PARADOX');

I doubt that Oracle will work with ADO (I have no idea if that's true), so I expect that you will have to use an ODBC connection. This is how we connected to Access before we used ADO connections:

Parameters := TStringList.Create;
If Session.IsAlias('AliasXYZ') then
Session.DeleteAlias('AliasXYZ');
Parameters.Add('DATABASE NAME=H:\XYZ\Main.mdb');
Parameters.Add('ODBC DSN=ODBC_XYZ');
Session.AddAlias('AliasXYZ', 'Microsoft Access Driver (*.mdb)', Parameters);
Parameters.free;

I doubt this is much help, but someone else will give you more useful information shortly.



 
You should take a look at the DbiAddAlias function. It's documented in BDE32.HLP. It basically adds a new alias to the BDE configuration file (IDAPI.CFG for example).

This procedure creates an alias to an Oracle database:

procedure CreateNewOracleDBEAlias(aAliasName, aSID, aUserName: string);
begin
DbiInit(nil);
DbiAddAlias(nil, PChar(aAliasName), 'ORACLE', PChar('NET PROTOCOL:TNS;SERVER NAME:' + aSID + ';USER NAME:' + aUserName + ';SQLQRYMODE:SERVER;SQLPASSTHRU MODE:SHARED NOAUTOCOMMIT'), True);
end;

Hope this helps :)
 
>I could have sworn someone wrote an FAQ on that, but I >don't see it in that section.

Perhaps you are referring to my thread102-342177?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top