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??
Can't connect to Oracle
-
- Devart Team
- Posts: 2420
- Joined: Wed 02 Nov 2011 09:44
Re: Can't connect to Oracle
1. Make sure that Oracle Client Software is installed on your computer;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."
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.
SQL Developer does not require the installation of Oracle Client. So make sure you have Oracle Client installed.earnshaw wrote:I can connect to my database using SqlDeveloper
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: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>"
Code: Select all
"Server=fooserver; Port=1521; Sid=foosid; User Id=foouser;Password=foopassword; Direct=true;"