Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I need to connect to an Oracle 9i Database from ASP.NET. Although I can connect to the Oracle Database through SQL*Plus.

 

I have downloaded and installed the latest Oracle ODBC drivers for 9.01 from Oracle's website and it didnt help. Also I installed Microsoft .NET Oracle Client and it produced the same results.

 

 

I have included the following namespaces and am using the following connection string to connect to Oracle -

 

 

<%@ Page Language="VB" Debug="true" Trace="true" %>

<%@ import Namespace="System.Data" %>

<%@ import Namespace="System.Data.OleDB" %>

 

szConStr = "Provider=OraOLEDB.Oracle;Data Source=abc; User ID=xyz; Password=xyz123;"

 

 

In ASP.NET however I get the following error -

 

ORA-12154: TNS:could not resolve service name

 

Stack Trace:

 

 

[OleDbException (0x80004005): ORA-12154: TNS:could not resolve service name]

System.Data.OleDb.OleDbConnection.ProcessResults(Int32 hr) +20

System.Data.OleDb.OleDbConnection.InitializeProvider() +57

System.Data.OleDb.OleDbConnection.Open() +203

ASP.G3_ASPX.Page_Load(Object Sender, EventArgs E) in D:\timesheet\ts04\g3.aspx:50

System.Web.UI.Control.OnLoad(EventArgs e) +67

System.Web.UI.Control.LoadRecursive() +35

System.Web.UI.Page.ProcessRequestMain() +725

 

 

What could be wrong. Please suggest. Thanks.

Posted
Check in Oracle Net Manager your service names. The message means that your Data Source=abc is invalid and has nothing to do with ADO.Net. I use this client without problems.

A man and a dog have an average of three legs.

Beaware of Statistics.

Posted

Hi hrabia,

 

I can use the same datasouce name to connect to the database from VB 6 using ADO so I guess the datasource name isn't the culprit. Any other suggestions. Thanks.

Posted
Show your code. Are you using Oracle.DataAccess.Client.OracleConnection object for connection?

A man and a dog have an average of three legs.

Beaware of Statistics.

Posted

You seem a little confused as to what provider you are using. Be carefull. Some of the post are telling you to use the Oracle.DataAccess.Client objects, but you mentioned you were using OLEDB. That's a conflict. If you are using OLEDB then try this for your connection string

strAdoDCCon = "Provider=MSDAORA.1;Password=123;User

ID=user;Data Source=DS.world;" & "Persist Security Info=True"

 

This all changes if you use something other than OLEDB. I would advise that once you make OLEDB work to venture down the ORACLE .NET Provider route since it is mentioned to be 200 percent faster.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...