Page 1 of 1

ORA-12154 Error

Posted: Fri 14 Oct 2011 15:28
by binfch
Hi there

I am trying to connect to an Oracle 10 database (OCI mode) within Delphi and Lazarus and I get an ORA-12154 error.

my tnsoranames looks like:

ORCL.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.2)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl.world)
)
)


my connect string looks like:

vin_ws_dev/[email protected]:1521:sn=orcl.world

Any idea what could be wrong?

P.S:
- Other tools PL/SQL Developer, TOAD, etc... do connect well to Oracle.
- ODAC in direct mode does connect well.

Thanks in advance,
Peter

Posted: Mon 17 Oct 2011 11:18
by AlexP
Hello,

To connect in the OCI mode, the connection string should look like:

vin_ws_dev/[email protected]

Posted: Mon 17 Oct 2011 14:45
by binfch
Hi there

I tried the ConnectString you proposed, but it is not working eather -> Same error.

The test DFM:

Code: Select all

object Form1: TForm1
  Left = 368
  Top = 124
  Width = 1006
  Height = 460
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object OraSession1: TOraSession
    Username = 'vin_ws_dev'
    Password = 'xxxxxx'
    Server = 'orcl.world'
    HomeName = 'OraClient10g_home1'
    Left = 88
    Top = 72
  end
end
- Windows 7
- Delphi 7
- ODAC 8.0.1
- ORACLE 10.2
- SQL*Net 10.2

Thanks & cheers,
Peter

Posted: Wed 19 Oct 2011 05:47
by AlexP
Hello,

I cannot reproduce the problem with ODAC: in the OCI mode, it connects to the server successfully even if there is a dot in SID (orcl.world). Check that SID and ServiceName of your server coincide.

Posted: Wed 19 Oct 2011 06:33
by binfch
Ok, I think I found the reason -> Beside the remote Oracle instance I also have a local OracleXE installed -> Looks like ODAC had problems resolving the correct tnsnames.ora.

Thx & cheers,
Peter

Posted: Wed 19 Oct 2011 08:32
by AlexP
Hello,

ODAC uses default Oracle client by default, and if there is no record about your remote server in the tnsnames.ora file, ODAC cannot connect with it. You can set the needed Oracle client in the OraSession.HomeName property:

OraSession.HomeName := 'ORACLE_CLIENT_11'

Posted: Wed 19 Oct 2011 08:52
by binfch
Hi there

I understand and I did/tried that -> See DFM extract above where I set:

Code: Select all

HomeName = 'OraClient10g_home1'
That is the default Oracle client with the correct tnsnames.ora. It seems that this property HomeName has no effect.

-> Anyway, now that I deinstalled my local OracleXE it works :)

Thx & cheers,
Peter

Posted: Thu 20 Oct 2011 08:34
by AlexP
Hello,

We've checked this situation once more, and if different Oracle clients are stated in the HomeName property, ODAC connects to a database using the corresponding client specified in HomeName. Maybe the tnsnames.ora file of the local client was setup incorrectly or several tnsnames.ora files were available.