Connection Error:Oracle.DataAccess.Client.OracleException ORA-12170

psyb0rg picture psyb0rg · Apr 3, 2010 · Viewed 8.8k times · Source

This has taken many hours of mine. I have to get this .Net app to run on an XP system. Someone seems to have messed up some files so conn.Open() in the C# is causing this error:

    Connection Error:Oracle.DataAccess.Client.OracleException ORA-12170: 
TNS:Connect timeout occurred at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection 
conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at 
Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, 
IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleConnection.Open() at 
Service.connect(Int32 sql_choice, String databaseIdentifier, String authenticationKey) in 
c:\Documents ....

This is my sqlnet.ora file:

# sqlnet.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\sqlnet.ora

SQLNET.AUTHENTICATION_SERVICES= (NTS)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

SQLNET.INBOUND_CONNECT_TIMEOUT = 180
SQLNET.SEND_TIMEOUT = 180
SQLNET.RECV_TIMEOUT = 180

This is tnsnames.ora:

# tnsnames.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORACLE2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dell )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = oracle2)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = dell )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

This is listener.ora:

# listener.ora Network Configuration File: C:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = dell  )(PORT = 1521))
    )
  )

I've tried changing the host name to localhost, 127.0.0.1 but that doesn't work. Also,

  • I can execute queries from SQL Plus.
  • There are NO firewalls on the system
  • The .Net app and DB are on the same machine.

Answer

DCookie picture DCookie · Apr 3, 2010

A similar SO question was solved when it was determined that the database was installed on a Windows box using DHCP. As I said in that answer, the Microsoft Loopback Adapter needs to be installed if you use DHCP on a Windows box with Oracle.