ORA-12154 Error

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
binfch
Posts: 33
Joined: Sat 22 Jan 2011 09:26

ORA-12154 Error

Post by binfch » Fri 14 Oct 2011 15:28

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Mon 17 Oct 2011 11:18

Hello,

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

vin_ws_dev/[email protected]

binfch
Posts: 33
Joined: Sat 22 Jan 2011 09:26

Post by binfch » Mon 17 Oct 2011 14:45

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 19 Oct 2011 05:47

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.

binfch
Posts: 33
Joined: Sat 22 Jan 2011 09:26

Post by binfch » Wed 19 Oct 2011 06:33

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Wed 19 Oct 2011 08:32

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'

binfch
Posts: 33
Joined: Sat 22 Jan 2011 09:26

Post by binfch » Wed 19 Oct 2011 08:52

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

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Thu 20 Oct 2011 08:34

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.

Post Reply