我们有一个32位的.Net Windows应用程序,它使用ODAC 10g(1.x)连接到后端的10g数据库。 事情在这次部署中运作良好。
我们正在建立一台新的开发机器。 这台机器上安装了ORACLE 11g(64位)。 我们遇到了连接数据库的问题。
dataString = "user id=xxx;password=\"xxx\";data source=localhost:1521/ORCL";
using (OracleConnection oraconn = new OracleConnection(dataConn))
{
oraconn.Open();
Oracle.DataAccess.Client.OracleCommand cmd = new OracleCommand(sOraSQL, oraconn);
cmd.CommandType = CommandType.Text;
Oracle.DataAccess.Client.OracleDataAdapter da = new OracleDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
oraconn.Close();
return dt;
}
ora-12514:TNS:侦听器当前不知道连接描述符
中请求的服务# tnsnames.ora Network Configuration File: C:\app\DjM\product\11.2.0\dbhome_1 \network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.168.1.100)
)
)
# 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.
SQLNET.AUTHENTICATION_SERVICES = (NTS)
"user id=xxx;password=\"xxx\";data source=localhost:1521/ORCL"
我们能够运行SQLDeveloper并指向相同的SID(ORCL),我们可以很好地连接到数据库实例。
我们还能够在原始机器上安装11g 32位ODAC,并且在那里工作正常。
这必须是与tnsnames相关的配置或类似的东西。