Solved

Need sample of code accessing Oracle database with either ADO or BDE components

Posted on 2006-11-08
3
391 Views
Last Modified: 2013-11-23
I use ADO to access a MS/SQL database
I need now to acces an Oracle (9) database
A couple of connection samples and queries syntax with ADO will be what I am looking for
Also, what do I have to install on my PC (Oracle layer) ?
0
Comment
Question by:LeTay
3 Comments
 
LVL 24

Expert Comment

by:Tomas Helgi Johannsson
ID: 17897479
    Hi!

If you don't have Oracle installed on the same computer you are developing on
then
1 you should download and install the Oracle Client.
2 Setup an ODBC connection to the database
3 and connect to the database using TADOConnection with the ODBC name you choose.

Everything else should be the same (that's if you follow the ANSI92/99 SQL standard in
your queries.

Regards,
  Tomas Helgi
0
 
LVL 1

Accepted Solution

by:
bhavesh_joshi earned 500 total points
ID: 18339716
 Hi!

1)You will have to install Oracle Client on each PC where you want your application to be run.

2)You will  have to configure the oracle client on each client computer using the Net Configuration Assistant for connecting to the Oracle Database Server. select "Local Net service Name Configuration" in the assistant wizard.

3)Connect to the database using TADOConnection as follows
a)Select "Oracle Provider for OLEDB" on the provider Tab of Adoconnection
b)In the Data Source enter the service name created in step 2
c)Enter the username and password and test the connection.
0
 
LVL 1

Expert Comment

by:Balshe
ID: 18626933
YOU CAN USE THIS CODE

PUT
DB, DBTables IN THE USES


USES
DB, DBTables;




var
  DBKEM:TDatabase;
  QRY:TQuery;
begin


   DBKEM:=TDatabase.Create(self);

   DBKEM.DatabaseName := 'DBKEM';
   DBKEM.DriverName := 'ORACLE';
   DBKEM.LoginPrompt := False;
   DBKEM.Params.Add('SERVER NAME=orasrv');
   DBKEM.Params.Add('USER NAME=useR1'      );
   DBKEM.Params.Add('NET PROTOCOL=TNS');
   DBKEM.Params.Add('OPEN MODE=READ/WRITE');
   DBKEM.Params.Add('SCHEMA CACHE SIZE=8');
   DBKEM.Params.Add('LANGDRIVER=');
   DBKEM.Params.Add('SQLQRYMODE=');
   DBKEM.Params.Add('SQLPASSTHRU MODE=SHARED AUTOCOMMIT');
   DBKEM.Params.Add('SCHEMA CACHE TIME=-1');
   DBKEM.Params.Add('MAX ROWS=-1');
   DBKEM.Params.Add('BATCH COUNT=200');
   DBKEM.Params.Add('ENABLE SCHEMA CACHE=FALSE');
   DBKEM.Params.Add('SCHEMA CACHE DIR=');
   DBKEM.Params.Add('ENABLE BCD=FALSE');
   DBKEM.Params.Add('ENABLE INTEGERS=FALSE');
   DBKEM.Params.Add('LIST SYNONYMS=NONE');
   DBKEM.Params.Add('ROWSET SIZE=20');
   DBKEM.Params.Add('BLOBS TO CACHE=64');
   DBKEM.Params.Add( 'BLOB SIZE=32');
   DBKEM.Params.Add('OBJECT MODE=TRUE');
   DBKEM.Params.Add('PASSWORD=userpass');
//   DBKEM.Session.AutoSessionName:=true;
   DBKEM.Connected:=true;



 QRY:=TQuery.Create(self);
   QRY.DatabaseName :='DBKEM';
   qry.SQL.Add('select * from table');
   qry.Open;
    // do what you want
   qry.Close;


0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now