Connecting to Oracle

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.
LVL 1
jacobyAsked:
Who is Participating?
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
fvaCommented:
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
 
fvaCommented:
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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
FrodoBegginsCommented:
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
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
FrodoBegginsCommented:
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
 
jacobyAuthor Commented:
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
 
fvaCommented:
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
 
fvaCommented:
Oops, I was trying to be helpful, but I only managed to unknowingly "quote" Mohammed. Sorry.
F.
0
 
jacobyAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.