Reputation: 629
I am using Delphi 5 version and I want to connect to Oracle Database. I am having TDatabase component. I don't have any idea about how to connect to database through Delphi. Please provide the steps to connect database. thanks.
Upvotes: 2
Views: 6489
Reputation:
If you have the Enterprise version of Delphi 5 you can connecto to Oracle using the BDE and the Oracle SQL Link. That's the fastest way to use Oracle from D5. If you have the Professional version, you can use Oracle using the BDE through ODBC. The Enterprise version also should already have the ADO components, but in my tests then it was an inferior solution to the SQL Links, although if you have to port later to a newer Delphi release it is still supported while the BDE and the SQL Links are not.
The steps to connect are detailed in the help and the manuals.
Upvotes: 0
Reputation: 43053
That's funny, I've just finished (some minutes ago) the port of my Open Source native Oracle access to Delphi 5.
Here are the main features of this unit:
See this web site for more details and feedback.
You have a TQuery
like wrapper, to write code just like with the BDE.
Or you can write code as such:
procedure Test(Props: TOleDBConnectionProperties; const aName: RawUTF8);
var I: ISQLDBRows;
begin
I := Props.Execute('select * from Domain.Customers where Name=?',[aName]);
while I.Step do
writeln(I['Name'],' ',I.['FirstName'],' ',I['Address']);
end;
var Props: TOleDBConnectionProperties;
begin
Props := TSQLDBOracleConnectionProperties.Create(
'TnsName','UserName','Password',CODEPAGE_US);
try
Test(Props,'Smith');
finally
Props.Free;
end;
end;
Unfortunately, Delphi 5 do not allow late-binding via a variant, which is allowed with Delphi 6 and up:
procedure Test(Props: TOleDBConnectionProperties; const aName: RawUTF8);
var I: ISQLDBRows;
Customer: Variant;
begin
I := Props.Execute('select * from Domain.Customers where Name=?',[aName],@Customer);
while I.Step do
writeln(Customer.Name,' ',Customer.FirstName,' ',Customer.Address);
end;
If you really want to use the DB components in a RAD approach, take a look at the corresponding page in Torry's page:
You'll find there some old free components, mostly created at Oracle 8 time (SynDBOracle is optimized for Oracle 11g but will work with earlier versions of Oracle), but which may better suit your need for Oracle connection without the BDE.
Of course, there are also some very good commercial components around, still working with Delphi 5. But you'll have to pay the high price... and should better upgrade to a newer Delphi version, by the way. ;)
Upvotes: 2
Reputation: 136441
The TDatabase
component is part of the BDE (Borland Database Engine)
, which is a deprecated technology, instead try using another alternatives which supports Oracle like ADO or Zeos
. For an introduction to ADO check the Embarcadero Docs. Working with ADO Components
and if you choose Zeos check the Official documentation.
Upvotes: 2