?
Solved

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

Posted on 2006-11-08
3
Medium Priority
?
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 25

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 1500 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month9 days, 1 hour left to enroll

765 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