This discussion is archived
1 Reply Latest reply: Jan 24, 2013 3:46 PM by Alex_Keh - Oracle_Product_Manager RSS

Connection error after upgrading from ODAC 9i to 11.2

986428 Newbie
Currently Being Moderated
I'm having trouble pinpointing the cause of an inconsistent error I'm getting in an application connecting to our Oracle database after updating from ODAC 9i to 11.2. When the application tries to open the oracle connection, I get the following error:

message: ""
error code: -2147467259
stack trace:
at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck)
at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
at Oracle.DataAccess.Client.OracleConnection.Open() . . .

However, the connection is successful through other applications such as PL/SQL, sqlplus, and even a new .Net test form I wrote to double check the install. After searching this error, I have already tried double checking TNSNames.ora (which is correct), ensuring that there is only one copy oracle installed on the machine, and the firewall on the machine running the application. I'd appreciate any help you could offer to point me in the right direction.

My current setup:
* Windows 7 64 bit
* VS 2010 with .Net 4
* ODAC 11.2 Release 5 (11.2.0.3.20)
* The application is 32 bit
* Database server is on 10g (I've also tried unsuccessfully with a test version on 11g)

The code that opens the connection is:
using Oracle.DataAccess.Client;
    public partial class MyClass
    {
        OracleConnection _dbConnection;
        String _dbUserName;
        String _dbPassword;
        String _dbSourceString;

        public void OpenConnection()
        {
            String connectionString = "User Id=" + dbUserName + ";Password=" + dbPassword + ";Data Source=" + _dbSourceString + ";";
            _dbConnection = new OracleConnection(connectionString);
            try
            {
                _dbConnection.Open();
            }
            catch (OracleException e)
            {
                MessageBox.Show("Connection String: \n" + _dbConnection.ConnectionString + "\n\nError Message: " + e.Message,
                    "Database Connection Failure", MessageBoxButtons.OK);
            }
        }
    }
  • 1. Re: Connection error after upgrading from ODAC 9i to 11.2
    Alex_Keh - Oracle_Product_Manager Expert
    Currently Being Moderated
    The most common reason for this error is a mismatch between Oracle.DataAccess.dll version and the unmanaged ODP.NET DLLs it's picking up from the PATH.

    Is this happening when opening a connection or first calling an ODP.NET API? If it's the latter, then it's likely a config issue. If that is the case, I would first try to de-install all ODAC instances on the machine and re-install ODAC 11.2 R5.

    The reason that I recommend the de-install is because of ODP.NET 9.2. Back then, Oracle used a different versioning mechanism that may give it precedence over ODP.NET 11.2. Removing all ODAC instances besides the one you want to use removes the need to worry about Oracle.DataAccess.dll picking up the wrong version of its unmanaged DLLs.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points