简体   繁体   中英

OracleConnection throw null exception upon Open()

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM