Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

OracleConnection causes an System.NullReferenceException

407989Dec 21 2006 — edited Feb 14 2008
Environment: WinXP Pro
ODP.NET file version10.1.0.400
VS 2003 ver#7.1.6030
.NET ver# 1.1.4322 SP1
Microsoft Visual Basic .NET 69462-270-0000007-18225
Microsoft Visual C# .NET 69462-270-0000007-18225

I've tried to get a connection to Oracle via ODP but I get this error,'An unhandled exception of type 'System.NullReferenceException' occurred in oracle.dataaccess.dll
Additional information: Object reference not set to an instance of an object.', when I try to get the exception info/message. I've used VB.NET and C# hoping it would make a difference, I need help.

Thanks.


Sample Code:

try
{
OracleConnection oOracleConnection = new OracleConnection("user id=uuid;password=pwd;data source=dev");

oOracleConnection.Open();

if( oOracleConnection.State == ConnectionState.Open )
{
label1.Text = "Opened";

oOracleConnection.Close();
}
else
{
label1.Text = "Not open";
}

oOracleConnection.Dispose();
}
catch( Oracle.DataAccess.Client.OracleException ex )
{
label1.Text = ex.ToString();//or ex.Message;

}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 13 2008
Added on Dec 21 2006
6 comments
4,694 views