| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> .Net OracleConnection Issue
Hello, I'm using the oracleclient namespace to attempt to connect to a
Oracle 8 db on a server.
I have the following code:
try
{
string connectionString = "Data Source=ODS;User
ID=xxx;Password=xxx";
using (OracleConnection mdgDBconn = new
OracleConnection(connectionString))
{
mdgDBconn.Open();
Console.WriteLine("ServerVersion: " +
mdgDBconn.ServerVersion
+ "\nDataSource: " + mdgDBconn.DataSource);
}
}
catch (OracleException exc)
{
MessageBox.Show(exc.Message);
}
An exception is thrown saying
ORA-125-05 TNS listener can not resolve SID given in the connect descriptor.
I have the ODS in my tsnames.ora file shown:
ODS =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.207.249.2)(PORT = 1521))
)
(CONNECT_DATA =
(SID = ODS)
)
)
If I use the tnsping ODS command, I get a "OK" response Also, I use the tnsping <ip>, I get the "OK" response.
If I change the connection string to use the IP address instead of the Service name, I get this exception.
ORA-12514: TNS:listener could not resolve SERVICE_NAME given is connect
descriptor.
Any idea what is the problem? I must be missing something in my Oracle
setup.
thanks
TRW Received on Fri Mar 03 2006 - 10:37:01 CST
![]() |
![]() |