0

When code reach .Open() method of OracleConnection object, it throw null exception, can't get why. Here is code:

using (OracleConnection connection = new OracleConnection($"User Id={dbLogin};Password={dbPass};Persist Security Info=False;Data Source={server}"))
{
    connection.Open();
}

All info being passed to connection string correctly. This sutiation happend when i'm trying to migrate from .Net oracle to ODA.NET, using Oracle.DataAccess v 4.0.3

Default System.Data.Oracle correctly opens the connection with that conenction string. Read mostly all topics about migration, no luck so far.

2
  • Ehm, no? Im asking why Open mothod throw that exception, since it's correctly initialized. Commented Apr 27, 2016 at 15:55
  • @OwenPauling The words 'null reference' in a post doesn't automatically qualify it as a duplicate. Commented Apr 29, 2016 at 2:45

1 Answer 1

1

Looks like the problem was in the corrupted Oracle Client installation.

Weird part - there was just NullRef exception with no ORA errors. After i've got proper install - everything works just fine.

Also reworked my code to OracleDataAdapter instead of OracleDataReader - code works faster and more stable.

Sign up to request clarification or add additional context in comments.

2 Comments

I have found that with ODP.Net you don't always get good error reporting if you use a generic exception handler, if you catch an OracleException you get the ORA- number that will give you more information
Thanks mate! But that part of my code can throw not only OracleException, and actually, i think that wasn't OracleProblem, just VS couldn't load dll's properly, or something like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.