Can't connect to Oracle

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
earnshaw
Posts: 4
Joined: Thu 10 May 2012 13:46

Can't connect to Oracle

Post by earnshaw » Fri 22 Jun 2012 17:12

I keep getting the following Oracle Exception message:
"Can not obtain Oracle client information from registry. Make sure that Oracle Client Software is installed, or use Direct mode of connecting to server."

when I try to connect to Oracle in my C# code:

OracleConnection conn;
conn = new OracleConnection("User Id=foouser;Password=foopassword;Server=//fooserver:1521/foosid;");
conn.Open(); //Oracle Exception occurs

When I add the following line:

conn.Direct = true;

It says that it cannot find my host:

"ORA-12545: Connect failed because target host or object does not exist <Host = //servername:1521/sidname:1521>"

- which is completely false, as I can connect to my database using SqlDeveloper and the exact same connection details without a problem.

This used to work before even without the conn.Direct = true, statement. This is so perplexing and I don't know what could be causing it!

Any ideas what else I can try??

Pinturiccio
Devart Team
Posts: 2141
Joined: Wed 02 Nov 2011 09:44

Re: Can't connect to Oracle

Post by Pinturiccio » Mon 25 Jun 2012 13:47

earnshaw wrote:I keep getting the following Oracle Exception message:
"Can not obtain Oracle client information from registry. Make sure that Oracle Client Software is installed, or use Direct mode of connecting to server."
1. Make sure that Oracle Client Software is installed on your computer;
2. Place the content of the ORACLE_HOME variable on the first position in the PATH variable of your operating system;
3. Make sure that capacity (x86 or x64) of your application and capacity of your Oracle client are the same.
earnshaw wrote:I can connect to my database using SqlDeveloper
SQL Developer does not require the installation of Oracle Client. So make sure you have Oracle Client installed.
earnshaw wrote:When I add the following line:

conn.Direct = true;

It says that it cannot find my host:

"ORA-12545: Connect failed because target host or object does not exist <Host = //servername:1521/sidname:1521>"
When you use the Direct mode you have to make additional changes in your connection string. In your case the connection string will be as follows:

Code: Select all

"Server=fooserver; Port=1521; Sid=foosid; User Id=foouser;Password=foopassword; Direct=true;"
For more information about using the Direct mode, please refer to http://www.devart.com/dotconnect/oracle ... tMode.html

Post Reply