Oracle connection error 12514

Posted by: Sahil Malik [MVP], on 08 Jun 2005 | View original | Bookmarked: 0 time(s)

Connecting Oracle 10g to .NET

Below are someone's successful steps -

First of all, I had to install the client part of Oracle 10g, and I installed everything, just to be sure that I didn't miss anything (485
Megabyte, Oracle Enterprise Manager included).

Then... I wrote this code:

OracleConnection myConnection = new OracleConnection("User
Id=ANDREA;Password=ASDASD;Data Source=WIN2003");
myConnection.Open();

Of course the username ANDREA exists in Oracle, the password is the right one and the server name is WIN2003 (if I ping WIN2003 it replies back correctly). Before trying to connect with .NET I verified that the Oracle Enterprise Manager (java version, not the web version) worked fine.

BUT!!!! I get this error...
ORA-12514: the listener doesn't recognize the requested service in the connection descriptor

(Sorry if the message doesn't match, but I am Italian and my message was in Italian, so I had to translate it!)

I didn't have much luck with google. I tried to look for these keywords

OracleConnection 12514 but I got no results. So I found the solution myself. The Oracle's listener seems to identify the .NET connection using the same entry that you can find in the file "tnsnames.ora". This is my file:

# tnsnames.ora Network Configuration File:
C:\Oracle\product\10.1.0\Client_1\NETWORK\ADMIN\tnsnames.ora
# Generated by Oracle configuration tools.

ORCL_WIN2003 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = WIN2003)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCL)
      (SERVER = DEDICATED)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

Do you see that ORCL_WIN2003 Well, THAT is Data Source parameter that must be used in the connection string! That ORCL_WIN2003 is the result of the SID and the host name that you enter when you add a new database in the Oracle Enterprise Manager. So, my advice is: try to connect usingn the Oracle Enterprise Manager first, take a look in the "tnsnames.ora" file and then write your code.

The working version of my code is:

OracleConnection myConnection = new OracleConnection("User
Id=ANDREA;Password=ASDASD;Data Source=ORCL_WIN2003");
myConnection.Open();

Hopefully some one will benefit from this one day :-), plus it is a good peice of info to keep on my blog.

Original thread.

Advertisement
Free Agile Project Management Tool from Telerik
TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 2806 | Hits: 21

Similar Posts

  • Health Monitoring and ASP.NET MVC more
  • Keeping ELMAH's Error Log Size In Check more
  • Data Refresh Failed in Excel Services more
  • Validation - Part 3 - Server-Side more
  • Deleting All Records In a Table EXCEPT For the N Most Recently Added Records more
  • How to fix Sys.WebForms.PageRequestManagerParserErrorException in ASP.NET 2.0 AJAX 1.0 more
  • System.Data.OracleClient Deprecated more
  • Misfit Geek Podcast - Episode #2 Does VB have a Future ? more
  • Reporting Release History : Q1 2009 SP1 (version 3.0.9.430) more
  • Oracle Woos Microsoft OracleClient users more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD