Forum Stats

  • 3,783,368 Users
  • 2,254,767 Discussions
  • 7,880,374 Comments

Discussions

ORA-12154: TNS:could not resolve the connect identifier specified

807089
807089 Member Posts: 16
edited Nov 20, 2012 12:22PM in Oracle Provider for OLE DB
Hi all, I need your help.

I have this error in the oracle connection with OLEDB:

ORA-12154: TNS:could not resolve the connect identifier specified

Connection string:
cn.Open "Provider=OraOLEDB.Oracle;Data Source=C800FSI1_2;UserId=DIP;Password=XXXXXX;"
Listener.ora
# listener.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_2)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_2\bin\oraclr11.dll")
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = C:\app\Administrator
sqlnet.ora
# sqlnet.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

NAMES.DEFAULT_DOMAIN = C800FSI1
SQLNET.AUTHENTICATION_SERVICES = (none)
SQLNET.AUTHENTICATION = (none)
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
TnsNames.ora
# tnsnames.ora Network Configuration File: C:\app\Administrator\product\11.2.0\dbhome_2\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

C800FSI1_2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = C800FSI1_2)
    )
  )

ORACLR_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
    (CONNECT_DATA =
      (SID = CLRExtProc)
      (PRESENTATION = RO)
    )
  )

C800FSI1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = C800FSI1)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = C800FSI1)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )
Can you help me?

Edited by: user6317803 on 26-gen-2011 13.13

Best Answer

  • gdarling - oracle
    gdarling - oracle Member Posts: 2,034
    Accepted Answer
    What Oracle Home is being used when you use OLEDB? Is it C:\app\Administrator\product\11.2.0\dbhome_2 ?

    If not, try copying tnsnames.ora and sqlnet.ora from C:\app\Administrator\product\11.2.0\dbhome_2\network\admin to the %ORACLE%\network\admin directory of the home you're using OLEDB wtih.

    Hope it helps,
    Greg

Answers

  • Is this behavior OLEDB specific? Are you able to connect using sqlplus out of the same home?

    You apparently have multiple homes (judging by dbhome_2). Did you configure tnsnames.ora in the home oledb is using?

    Greg
  • 807089
    807089 Member Posts: 16
    edited Jan 27, 2011 4:04PM
    Is this behavior OLEDB specific? Are you able to connect using sqlplus out of the same home?
    No, I don't do it... can you tell me how I do for this?

    You apparently have multiple homes (judging by dbhome_2). Did you configure tnsnames.ora in the home oledb is using?
    I don't understand the answer.

    Thanks x your help.

    Edited by: user6317803 on 27-gen-2011 13.01
  • 807089
    807089 Member Posts: 16
    Can you help me?
  • gdarling - oracle
    gdarling - oracle Member Posts: 2,034
    Accepted Answer
    What Oracle Home is being used when you use OLEDB? Is it C:\app\Administrator\product\11.2.0\dbhome_2 ?

    If not, try copying tnsnames.ora and sqlnet.ora from C:\app\Administrator\product\11.2.0\dbhome_2\network\admin to the %ORACLE%\network\admin directory of the home you're using OLEDB wtih.

    Hope it helps,
    Greg
  • 807089
    807089 Member Posts: 16
    edited Feb 12, 2011 7:14AM
    Thanks x your answer... very appreciad...

    The system is windows server 2008 R2 Enterprise.

    The error is:
    ORA-12154: TNS:could not resolve the connect identifier specified

    String connection:
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "Provider=OraOLEDB.Oracle;Data Source=myDB;UserId=DIP;Password=XXXXX;"

    This connection working if try in the software Navicat.

    I have copy the files tnsnames.ora and sqlnet.ora from
    C:\app\Administrator\product\11.2.0\dbhome_2\network\admin
    to the
    C:\app\Administrator\product\11.2.0\dbhome_2\oledb

    But not change the situation... sorry :(

    Edited by: user6317803 on 12-feb-2011 4.14
  • 807089
    807089 Member Posts: 16
    Solved :)
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.Open "Provider=OraOLEDB.Oracle.1;Password=XXXXXX;Persist Security Info=True;User ID=DIP;Data Source=myDB"
    
    cn.Close()
    Set cn = Nothing
  • 947793
    947793 Member Posts: 3
    hi, all,
    I am facing the same problem!!! and tried all these solutions...but no luck :-(((((((((((((((
    Please help me
    cn.Open "Provider=OraOLEDB.Oracle.1;" & _
    "Data Source=" & db & ";" & _
    "User ID=" & usrnm & ";" & _
    "Password=" & psd & ";" & _
    "Persist Security Info= True " & ";"
This discussion has been closed.