Я пытаюсь подключиться к оракулу БД с помощью ASP.NET/C#.
Вот мой код:
OracleConnection connection = new OracleConnection();
connection.ConnectionString = @"Data Source=ORACLEDB;User id=me;Password=xxxx;";
try
{
connection.Open();
}
catch (Exception ex)
{
Console.WriteLine("Exception occurs when connecting to DB : " + ex.Message + ex.StackTrace);
}
и вот ошибка, которую я получаю:
ORA-12154: TNS : the identifier could not be solved
Вот мой TNSNAMES.ora:
ORACLEDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = myComputer.myDomain)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ORACLEDB)
)
)
Я работаю на Win2k3 сервере R2.
Oracle находится на том же сервере.Это Oracle 11g.
Когда я делаю tnsping, я получаю это:
EZCONNECT adapter used to resolved the alias
Tentative de contact de (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=TCP)(HOST=169.254.216.123)(PORT=1521)))
OK (20 msec)
А вот мой слушатель.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\app\Administrator\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\app\Administrator\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = myComputer.myDomain)(PORT = 1521))
)
)