Solved

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

Posted on 2006-11-08
3
394 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 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 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

813 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

14 Experts available now in Live!

Get 1:1 Help Now