3

Im developing an application in C# that connects to Oracle 10g.

When I use ODP. Net and this

Connection String "Data Source=Angelo-HP/XE;User ID=MAPFRE;Password=123456" I can connect and perform any action with the database,

but when I use OleDbConnection (System.Data.OleDb) with this

connection String: "Provider=OraOLEDB.Oracle;OLEDB.NET=true;PLSQLRSet=true;User ID=mapfre;password=123456;Data Source=XE" I got this error:

ORA-12154: TNS:could not resolve the connect identifier specified

When I try use Open() method from OleDbConnection.

I think is not oracle configuration because I can connect from ODP and sqldeveloper client.

Any idea?

Thanks,

2
  • Do you have the tns names setup correctly on your oracle client? %oraclehome%\network\admin Commented Oct 6, 2012 at 2:51
  • 1
    Your DataSource value is different in both connection string examples. Commented Oct 6, 2012 at 2:56

2 Answers 2

0

Try the connection strings at the link below:

Oracle Connection String Samples

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

Comments

0

This issue may occur if you have multiple versions of oracle on your computer.

try these steps

  1. go to network folder of oracle and open tnsnames.ora
  2. search for the your DB name (XE in this case)
  3. this will have your data source information (EX : (DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(Host = xx.xx.xx.xx)(Port = xxxx)))(CONNECT_DATA =(SERVICE_NAME = XP))))
  4. use this in Data source field of your connection string . (EX: Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(Host = xx.xx.xx.xx)(Port = xxxx)))(CONNECT_DATA =(SERVICE_NAME = XP)));")

also, make sure your solution was built in anyCPU mode and make sure in App Pool enable 32 bit is true

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.