Re: Connecting to an Oracle database



Hi Bengt,

If you have SQL*PLUS (Oracle product) installed on your system you can use
it to connect to the database and immediately after you connect Oracle
provides the version information. Which will be similar to the following:

SQL*Plus: Release 9.2.0.6.0 - Production on Mon Oct 10 07:49:51 2005

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production


If you have only one database installed on your system, then the default
database name (sid) is ORCL. Which may also be spelled, Orcl or orcl. With
older versions of SQL*NET you could specify '2:' as the database name and
you would connect with the default databse on your system.

D6/D7 Professional will not connect to Oracle without a 3rd party product
(OCI, DOAC, etc). And when you use either of those products you must use
their connection, query, components, etc. not the standard ADO components.
I have used both products successfully in D6 and D7. You just have to
conform to their programming paradigm.

Regards,

Michael



"Bengt Håkansson" <Bengt.Hakansson@xxxxxxxxx> wrote in message
news:434a29de@xxxxxxxxxxxxxxxxxxxxxxxxx
> Hi Michael,
> how can I see which version of Oracle I use? The database I try to connect
> to is a part of an application that I am going to start selling and
> supporting, but the programming and further develpopment is made in
> another country, and in Oracle form and reports. I have not the Oracle
> development system on my computer, only the user program. However, it
> would be very useful to be able to access the database from Delfi. Then I
> could make small programs, for instance for populating the Oracle database
> with data from the cusotmers old programs when making installations.
>
> I have never worked with Oracle before, but with Delphi 6 prof. and ADO
> components against Access databases. According to the Borland agent in
> Sweden, that should work. (I also have D7 prof. and D8.net enterprise, but
> in the latter, there is no normal Delphi version which I thought it would
> be when I bought it). I have also installed alternative component for
> Oracle access from http://sourceforge.net/projects/delphioci/ to test
> other possibilities, but the problems are the same with them. It seems
> that I need the the name of the database, but I am not able to find that.
>
> Maybe, it is not enough to have the Oracle client that I have on my
> computer, but I can access and change the database with Toad by means of
> SQL questions. However, It is not possible to use Toad for reading large
> quanitites of data from ascii files into the database, and that is what I
> need to do.
>
> Regards,
> Bengt
>
> "Michael Jacobs" <iq193@xxxxxxxxxxxxx> wrote in message
> news:43481c9c$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>> Hi Bengt,
>>
>> Which version of Oracle 7.3.4 is installed on your system, Personal or
>> Enterprise?
>>
>> Thanks,
>>
>> Michael
>>
>> "Bengt Håkansson" <Bengt.Hakansson@xxxxxxxxx> wrote in message
>> news:434682be$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>>> Hi Michael,
>>>
>>> thank you for your taking time to help me.
>>> My application and the database are on the same computer and it is
>>> Oracle 7.3.4 database.
>>> I have installed Toad for Oracle, and there I can see all the content of
>>> ted database. In Toad I enter @ as name of the database. I suppose that
>>> is special for Toad. The application, of couse, also work.
>>>
>>> When I try with the connection string
>>> Provider=MSDAORA.1;Password=rebbeb;User ID=bssys;Data Source=2:;Persist
>>> Security Info=True
>>>
>>>
>>>
>>> I get the following error message when pressing the Test Connection
>>> button.
>>>
>>> Test connection failed because of an error in initializing provider.
>>> ORA-06401: NETCMN: invalid driver designation
>>>
>>>
>>> I use MSDAORA. I cannot find OraOLEDB.Oracle on my system. I use Delphi6
>>> Professional.
>>>
>>> /Bengt Håkansson
>>>
>>>
>>>
>>>
>>>
>>> "Michael Jacobs" <iq193@xxxxxxxxxxxxx> wrote in message
>>> news:434665aa$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>> Hi Bengt,
>>>>
>>>> I'll try to explain what you are seeing in the files.
>>>> From the information you provided, you are trying to use Net8 to
>>>> connect to an Oracle 7.3 database.
>>>>
>>>> 'Beq' is the 'bequeath' protocol. Oracle uses that when the
>>>> application and the database are located on the same system. And when
>>>> the application and database are located on the same system and SQL*Net
>>>> was used, '2:' was acceptable as the database name.
>>>>
>>>> I do not see an entry for a 'TCP/IP' connection to the database, so
>>>> therfore I must assume that your application and Oracle are on the same
>>>> system. If so, are all the correct services running on the system?
>>>>
>>>> If your application and Oracle aren't on the same system, you will
>>>> need an entry in your TNSNAMES.ORA file (case-sensitive on Unix but not
>>>> on Windows)
>>>>
>>>> You cannot specify the path to the database to establish a
>>>> connection. Oracle doesn't permit this.
>>>>
>>>> The following snippet is from a TNSNAMES.ORA for an Oracle 9.2
>>>> installation.
>>>>
>>>> ORCL =
>>>> (DESCRIPTION =
>>>> (ADDRESS_LIST =
>>>> (ADDRESS = (PROTOCOL = TCP)(HOST = evilnotebook)(PORT = 1521))
>>>> )
>>>> (CONNECT_DATA =
>>>> (SERVER = DEDICATED)
>>>> (SERVICE_NAME = ORCL)
>>>> )
>>>> )
>>>>
>>>> The service name is ORCL. The connection string is
>>>> 'username/password@ORCL'. When the connection is attempted, the Oracle
>>>> finds the matching entry for 'ORCL' and determines that it uses the TCP
>>>> protocol, is located on a system named 'evilnotebook' and uses PORT
>>>> 1521 for communication.
>>>>
>>>> Another question is which provider are you using in your application,
>>>> 'OraOLEDB.Oracle' or 'MSDAORA'.
>>>>
>>>> And finally, if your application and Oracle are not on the same system,
>>>> are you separated by a firewall?
>>>>
>>>> HTH,
>>>>
>>>> Michael
>>>>
>>>> "Bengt Håkansson" <Bengt.Hakansson@xxxxxxxxx> wrote in message
>>>> news:4345ae6f$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>>> Hi again,
>>>>>
>>>>> connecting to the Oracle database seems to be more or less impossible
>>>>> inside Delphi. When using Toad, I can connect to the database, but
>>>>> Toad work if @ is entered as database name. I have the database on a
>>>>> local computer and there are three
>>>>> 'Listener.ora' -files and three 'tnsnames.ora'-files. All of these are
>>>>> quite old, the newest being C:\Orant\NET80\ADMIN\SAMPLE\TSNNAMES.ORA.
>>>>> These are the first lines in this file:
>>>>>
>>>>> Beq-local.world =
>>>>> (DESCRIPTION =
>>>>> (ADDRESS_LIST =
>>>>> (ADDRESS =
>>>>> (COMMUNITY = beq.world)
>>>>> (PROTOCOL = BEQ)
>>>>> (PROGRAM = oracle73)
>>>>> (ARGV0 = oracle73ORCL)
>>>>> (ARGS = '(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))')
>>>>> )
>>>>> )
>>>>> (CONNECT_DATA = (SID = ORCL)
>>>>> )
>>>>> )
>>>>>
>>>>> I suppose that Service name is the same as the property
>>>>> DefaultDatabase in Delphi Object inspektor. I have talked with the
>>>>> programmer of the system I try to connect to and he told me either to
>>>>> use ORCL or 2: as database name. I have tried with both, and many
>>>>> others, but I always get the ORA-12154 error.
>>>>>
>>>>> I use the IP adress of ny local computer as Server Name oan user name
>>>>> and password are defenitely OK.
>>>>>
>>>>> Could it be necessary to specify the path to the Oracle database
>>>>> somewhere?
>>>>>
>>>>> I am totally lost after trying for a whole day.
>>>>>
>>>>> /Bengt Håkansson
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Michael Jacobs" <iq193@xxxxxxxxxxxxx> wrote in message
>>>>> news:43426fae$1@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>>>> Hi Bengt,
>>>>>>
>>>>>> To connect to Oracle, you need to provide the Server Name, the
>>>>>> 'service' name, the username and the password.
>>>>>>
>>>>>> The Server name is the name of the computer hosting Oracle. You may
>>>>>> use the IP address instead of name.
>>>>>>
>>>>>> The Service Name is the name of the database on the system as
>>>>>> defined in the 'Listener.ora' file on the host computer and the
>>>>>> 'tnsnames.ora' file on the local computer.
>>>>>>
>>>>>> If you are passing a null string as the service name, Oracle will not
>>>>>> be able to find a matching entry for that 'service name' and the will
>>>>>> result in hte ORA-12154 error.
>>>>>>
>>>>>> HTH,
>>>>>>
>>>>>> Michael
>>>>>>
>>>>>> "Bengt Håkansson" <Bengt.Hakansson@xxxxxxxxx> wrote in message
>>>>>> news:43413b94@xxxxxxxxxxxxxxxxxxxxxxxxx
>>>>>>> According to the help text, Servere name should be the name of the
>>>>>>> computer where the database is. If I enter that name together with
>>>>>>> the username I password I used when running the database application
>>>>>>> (Written in Wisual Basic) and press Test connection, I get the
>>>>>>> message Test connection failed because of an error in initializing
>>>>>>> provider. ORA-12154: TNS: could not resolve service name.
>>>>>>>
>>>>>>> /Bengt Håkansson
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.