1

I want to connect the oracle function and read any data from it,and i'm write this code for that purpose:

using (OracleConnection con = new OracleConnection("Data Source=WEBSERVICE_ACCESS;User Id=webservice_access;Password=xyz;"))
{
     con.Open();
     OracleCommand cmd = new OracleCommand("LOGIN");
     cmd.CommandType = System.Data.CommandType.StoredProcedure;
     //Add your parameters here
     cmd.Connection = con;
     OracleDataReader odr = cmd.ExecuteReader();
     while (odr.Read())
     {
          Console.WriteLine(odr.GetOracleValue(0));
     }
     Console.ReadLine();
 }

WEBSERVICE_ACCESS is my DATABASE NAME
webservice_access is my user name
but when run that code i get this error:

System.Data.OracleClient.OracleException: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor


What happened? How can I solve this?
enter image description here

6
  • 2
    Your connection string is wrong. Either that or the server is setup wrong. It is hard to diagnose any more without looking at your systems. Commented Jun 30, 2015 at 7:27
  • 1
    Also, I hope the password in your connection string is not the real one :-) Commented Jun 30, 2015 at 7:27
  • @RuneGrimstad I update my question,please review that.thanks Commented Jun 30, 2015 at 7:28
  • 1
    Is WEBSERVICE_ACCESS the name in your tnsnames? Commented Jun 30, 2015 at 7:31
  • @PatrickHofman WEBSERVICE_ACCESS is my Database name Commented Jun 30, 2015 at 7:54

1 Answer 1

2

The error ORA-12514 means that a listener received a request to establish a connection to a database or other service. The connect descriptor received by the listener specified a service name for a service (usually a database service) that either has not yet dynamically registered with the listener or has not been statically configured for the listener. This may be a temporary condition such as after the listener has started, but before the database instance has registered with the listener.

The possible resolutions for this error are

Check which services are currently known by the listener by executing: Hide Copy Code

lsnrctl services <listener name>

1) Check that the SERVICE_NAME parameter in the connect descriptor of the net service name used specifies a service known by the listener.

2) If an easy connect naming connect identifier was used, check that the service name specified is a service known by the listener.

3)Check for an event in the listener.log file

This answer on oracle forums should help you understand the difference between the SID and the SERVICE_NAME.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.