Hi;

The class OracleConnection is part of .NET and so is always available.
However, it does not work if the Oracle client software is not installed on a
user's system. How can I test for that being installed so I don't offer
Oracle as a choice if it can't be used?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

RE: How do I tell if the Oracle client is installed by ManishBafna

ManishBafna
Sun May 20 01:17:00 CDT 2007

Hi,
Try this code:
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\ORACLE");

if(key == null)
MessageBox.Show("Oracle not installed on client machine");
Hope this helps.
--
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"David Thielen" wrote:

> Hi;
>
> The class OracleConnection is part of .NET and so is always available.
> However, it does not work if the Oracle client software is not installed on a
> user's system. How can I test for that being installed so I don't offer
> Oracle as a choice if it can't be used?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
> Cubicle Wars - http://www.windwardreports.com/film.htm
>
>

RE: How do I tell if the Oracle client is installed by ManishBafna

ManishBafna
Sun May 20 05:19:13 CDT 2007

Hi,
A little correction in my code in previous post.It should be like this:
Microsoft.Win32.RegistryKey key =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Oracle");
if(key == null)
MessageBox.Show("Oracle not installed on client machine");
Hope this helps.
--
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"David Thielen" wrote:

> Hi;
>
> The class OracleConnection is part of .NET and so is always available.
> However, it does not work if the Oracle client software is not installed on a
> user's system. How can I test for that being installed so I don't offer
> Oracle as a choice if it can't be used?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
> Cubicle Wars - http://www.windwardreports.com/film.htm
>
>

RE: How do I tell if the Oracle client is installed by thielen

thielen
Sun May 20 09:17:00 CDT 2007

That helps - it will tell me if Oracle has never been installed on a
computer. Unfortunately it does not work if Oracle was uninstalled.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"Manish Bafna" wrote:

> Hi,
> Try this code:
> Microsoft.Win32.RegistryKey key =
> Microsoft.Win32.Registry.LocalMachine.OpenSubKey("HKEY_LOCAL_MACHINE\\SOFTWARE\\ORACLE");
>
> if(key == null)
> MessageBox.Show("Oracle not installed on client machine");
> Hope this helps.
> --
> Thanks and Regards.
> Manish Bafna.
> MCP and MCTS.
>
>
>
> "David Thielen" wrote:
>
> > Hi;
> >
> > The class OracleConnection is part of .NET and so is always available.
> > However, it does not work if the Oracle client software is not installed on a
> > user's system. How can I test for that being installed so I don't offer
> > Oracle as a choice if it can't be used?
> >
> > --
> > thanks - dave
> > david_at_windward_dot_net
> > http://www.windwardreports.com
> >
> > Cubicle Wars - http://www.windwardreports.com/film.htm
> >
> >

RE: How do I tell if the Oracle client is installed by ManishBafna

ManishBafna
Sun May 20 23:56:01 CDT 2007

Hi,
Below method is not elegant one but simple and reliable.You can do something
like this:
using System;
using System.Data;
using System.Data.OracleClient;

public bool IsOracleInstaled()
{
string connectionString = GetConnectionString();

using (OracleConnection connection = new OracleConnection(connectionString))
{
try
{
connection.Open();
return true;

}
catch (Exception ex)
{
return false;
}
}
}

--
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"David Thielen" wrote:

> Hi;
>
> The class OracleConnection is part of .NET and so is always available.
> However, it does not work if the Oracle client software is not installed on a
> user's system. How can I test for that being installed so I don't offer
> Oracle as a choice if it can't be used?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
> Cubicle Wars - http://www.windwardreports.com/film.htm
>
>

RE: How do I tell if the Oracle client is installed by v-wywang

v-wywang
Tue May 22 00:35:08 CDT 2007


I agree with Manish.
In my opnion, trying to connect Oracle server in coding is the simplest
(safest) way to check whether Oracle client software has been installed on
machine.

Have a great day,
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


RE: How do I tell if the Oracle client is installed by thielen

thielen
Tue May 22 08:13:03 CDT 2007

I don't think that will work as it will fail if the connection string is bad
too and I have no way of knowing what a good connection string is.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"WenYuan Wang [MSFT]" wrote:

>
> I agree with Manish.
> In my opnion, trying to connect Oracle server in coding is the simplest
> (safest) way to check whether Oracle client software has been installed on
> machine.
>
> Have a great day,
> Sincerely,
> Wen Yuan
> Microsoft Online Community Support
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>

RE: How do I tell if the Oracle client is installed by v-wywang

v-wywang
Tue May 22 23:22:52 CDT 2007

Hi Dave
Thanks for your reply.

Have you tried "OracleConnectionStringBuilder"? This is a new class
introduced in .net framework 2.0. Pass ServerName, PassWord and UserName to
this builder. It will build a correct connection for you. Hope this helps.

http://msdn2.microsoft.com/en-us/library/system.data.oracleclient.oracleconn
ectionstringbuilder.aspx
[OracleConnectionStringBuilder Class]

Please let me know if you still have any concern on this. I'm glad to work
with you.
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


RE: How do I tell if the Oracle client is installed by thielen

thielen
Wed May 23 00:04:00 CDT 2007

Hi;

The problem is I never want to give the user our Oracle connection dialog if
the Oracle client is not installed on their computer. So I need to know if
Oracle is installed before I get a connection string from them.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm




"WenYuan Wang [MSFT]" wrote:

> Hi Dave
> Thanks for your reply.
>
> Have you tried "OracleConnectionStringBuilder"? This is a new class
> introduced in .net framework 2.0. Pass ServerName, PassWord and UserName to
> this builder. It will build a correct connection for you. Hope this helps.
>
> http://msdn2.microsoft.com/en-us/library/system.data.oracleclient.oracleconn
> ectionstringbuilder.aspx
> [OracleConnectionStringBuilder Class]
>
> Please let me know if you still have any concern on this. I'm glad to work
> with you.
> Sincerely,
> Wen Yuan
> Microsoft Online Community Support
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>

RE: How do I tell if the Oracle client is installed by v-wywang

v-wywang
Wed May 23 07:28:11 CDT 2007

Hi Dave,
Thanks for your reply.

As far as I know, we can detect whether the Oracle Client has been
installed by Register key or connection.

If you truly do not want to get a connection string from user, I'm afraid
the only way is checking RegistryKey.

Another choice, you may use both. You may check the registry key and then
try to connect Oracle Database....

I also appreciate for any other better solution.
Sincerely,
Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


RE: How do I tell if the Oracle client is installed by ManishBafna

ManishBafna
Mon Jul 30 06:52:03 CDT 2007

Hi,
I know it is now too late but i have found solution for what you were
looking.Try this code:
If( Environment.ExpandEnvironmentVariables("%ORACLE%").ToString().ToUpper()
<> "%ORACLE%")
MessageBox.Show("Oracle is installed")

I have found that if oracle is installed then
Environment.ExpandEnvironmentVariables("%ORACLE%").ToString() gives path to
installation folder.
--
Hope this answers your question although late.
Thanks and Regards.
Manish Bafna.
MCP and MCTS.



"David Thielen" wrote:

> Hi;
>
> The class OracleConnection is part of .NET and so is always available.
> However, it does not work if the Oracle client software is not installed on a
> user's system. How can I test for that being installed so I don't offer
> Oracle as a choice if it can't be used?
>
> --
> thanks - dave
> david_at_windward_dot_net
> http://www.windwardreports.com
>
> Cubicle Wars - http://www.windwardreports.com/film.htm
>
>