Solved

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

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

696 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