Solved

Connecting to Oracle

Posted on 2001-08-13
10
390 Views
Last Modified: 2013-11-23
Hello,

maybe this is trivial, but well, it doesn't work, hehe.

Here is my problem : I have a little program, which have to connect to an Oracle Database.
the database is on the Local network. My program "just" need to connect to the server and check a table every 10 mins or so, but actually, i have no idea on how to connect to the base.
I guess i have to use BDE administrator to create an alias and use it on my form, but not sure.
Well, i am looking for help to do this :)
Any comments and ideas are welcome....

Thank you.
0
Comment
Question by:jacoby
  • 4
  • 2
  • 2
  • +1
10 Comments
 
LVL 4

Expert Comment

by:fva
ID: 6380233
First of all you should have the Oracle client installed and working on the machine where you want to run the program.
If you have that, you can create an proper alias in BDE for the connection with Oracle and use that one

or

you can use a TDatabase with driver=ORACLE but you'll have to set up the DB params by yourself in the code (a + is that the user will be less likely to mess with the settings as in the alias case)

I would use after that a TQuery containing a well-thought "select" statement to minimize the traffic on the net. (a.k.a. TQuery _not_ TTable )

Please call for further suggestions if I was too brief.

F.
0
 
LVL 4

Expert Comment

by:fva
ID: 6380246
BTW, there are some known issues about connection between BDE and Oracle. Please post the versions of BDE and Oracle used. Delphi's version might help, too.


F.
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6380275
You have to download Updated Oracle 8 SQL Links Driver (197,710 bytes) from http://www.borland.com/devsupport/bde/files/sqlora8_512.zip
It fixes very annoying bug in the BDE.

More info on
http://www.borland.com/devsupport/bde/bdeupdate.html

Rgds,
Frodfo
0
 
LVL 22

Expert Comment

by:mnasman
ID: 6380302
Hello

  here's 3 ways to connecting to Oracle


 to use the ado, you should have D5 enterprise edition, or if you have D5 Pro, you can buy ADOExpress
from borland store

1) Native Connection:

Go to the BDE Administrator, you need to make new alias here
from Object menu > New > Database driver name > Oracle
now you have new alisa called oracle1, or any thing you chose
you need to change some of oracle1 properties:
Server Name : OraServer (it's will be oracle service name in your machine)
Just insure net protocol is : TNS
choose apply for the alias
 now you have new alias connected to oracle, and you can access to it via
the table and query component like you connect to paradox or access

2) ADO

  this require you have delphi 5 enterprise edition, or delphi 5 pro with
ado express

from delphi in component palette switch to ADO

drop in the form ADOTable component
from object inspector we need to modifiy some properties of ADOTable

ConnectionString : double click on it
you will see new window, choose : use connection string then press Build
button
you will see datalink window now from provier tab choose > microsoft OLE DB
provider for oracle  then press next button
now in connection tab enter the following

Enter a server name : OraServer (oracle service name in your machine not the
alias name you created befor)
and enter the user name and password
click to check allow saving password check box
then click on Test connection, if it give you message "Test connection
Succeeded" that's mean you are connect now to oralce
then press ok button to close the this window and ok agian to close ado
connection window

again back to object inspector and now choose table name

3) ODBC
go to contorl panel, and than choose 32bit ODBC

in the user DNS tab choose Add, then choose Microsoft ODBC driver for oracle, then click finish
you will see now micosoft odbc driver for oracle setup dialog
in the dialog enter your informations
data source name : choose name to define the odbc for your application ( you will it as alias in BDE

admin.)
description : any thing
user name: any user is exist in the oracle database(Scott for testing)
connection string: choose your oracle server name

I hope that working with you, but anyway, I think if you use delphi native connection or ado to connect

to oracle
database, both of them better and faster than odbc


if you have Delphi 6 enterprise edition, you could use the DBExpress also

to check the tables in the oracle database use this select statment
"select * from tab"

Best regards
Mohammed Nasman
0
 
LVL 2

Expert Comment

by:FrodoBeggins
ID: 6380378
Mohammed is quite right. ADO is a new growing architecture, with big future. It allows you run away from BDE.

Native Connection is well-trained. Solid. :)

ODBC is something I don't use. Just imagine the system:
Layer 1: Database Server
Layer 2: Client for the database
Layer 3: ODBC
Layer 4: BDE
Layer 5: your program

In any of the layers there might be a bug. Less layers - less bugs :)
And, from my experience, Layers 3 and 5 have the biggest part of the bug-things. That's why I avoid using ODBC. Unfortunately L5 is unavoidable :)

Rgds,
Frodo
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:jacoby
ID: 6380490
oopps, my bad. I am using D5 enterprise, with BDE 5.01.
And Oracle is 8.06.

Oracle client is installed and work properly. (i'm working with Centura also, and it works well.)

Downloading and trying Frodo :)

Mohammed, i think that my problem is when i create the alias. i don't put the right name under servername. What should i put there ? the IP adress of the server and something else after that ?
I know that the name i put there is wrong as when i apply and check it again, it tells me invalid name ..

Thanks for your answers,

Fred Jacoby.
0
 
LVL 22

Accepted Solution

by:
mnasman earned 200 total points
ID: 6380651
Jacoby

  Did you try to connect the Oracle Client with the Oracle server with SQL Plus, what's the server name you use there?
it's will be the server Name in the OraServer in BDE Admin, it's the name you made with Net8 easy configuration

Try the ADO, you already have it, it's faster than the others ways, I test it with oracle, and it was faster than BDE

Mohammed
0
 
LVL 4

Expert Comment

by:fva
ID: 6380653
The name should be the TNS name you can use e.g. to tnsping the Oracle connection or the name you fill in as service name in SQLplus or equivalent.

F.
0
 
LVL 4

Expert Comment

by:fva
ID: 6380713
Oops, I was trying to be helpful, but I only managed to unknowingly "quote" Mohammed. Sorry.
F.
0
 
LVL 1

Author Comment

by:jacoby
ID: 6380821
YAY !!
It works :)

Many thanks to you all.
Frodo, i am running BDE 5.01 and the patch is for 5.11, so i couldn't test it.
I am accepting Mohammed comment as answer as the test with ADO is nice and works really well.

Best regards,

Fred Jacoby.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

762 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

23 Experts available now in Live!

Get 1:1 Help Now