Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Unable to establish connection to Oracle db with the Oracle.DataAccess.dll version 2.112.1.0

$
0
0

Hi

I am uable to connect to Oracle Database 11g (version 2.112.1.0). Getting below error.

ServerVersion = 'connection.ServerVersion' threw an exception of type 'System.InvalidOperationException'

'((Oracle.DataAccess.Client.OracleException)($exception)).DataSource' threw an exception of type 'System.NullReferenceException'

Can any one help me on this ?

Here is the sample code.

class

Program

{

staticvoid Main(string[] args)

{

String conStr ="Data Source=dbname;User ID=id;Password=pwd";

TestOracleConnection(conStr);

}

publicstaticstring TestOracleConnection(string _oraConnStr)

{

OracleConnection oc =null;

try

{

oc =

newOracleConnection(_oraConnStr);

oc.Open();

return"success";

}

catch (Exception _e)

{

return _e.Message;

}

finally

{

if (oc !=null)

{

oc.Close();

oc.Dispose();

}

}

}

}


shravan





Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>