这花了很多时间。我必须让这个.Net应用程序在XP系统上运行。有人似乎弄乱了一些文件,所以C#中的conn.Open()导致了这个错误:
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 ....
这是我的sqlnet.ora文件:
# 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
这是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)
)
)
这是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))
)
)
我已尝试将主机名更改为localhost,127.0.0.1,但这不起作用。此外,
答案 0 :(得分:0)
当确定使用DHCP在Windows机器上安装数据库时,similar SO question已解决。正如我在该答案中所说,如果您在带有Oracle的Windows机器上使用DHCP,则需要安装Microsoft环回适配器。