2

My connection is failing with the following message: "The procedure entry point ons_subscriber_cancelcallback could not be located in the dynamic link library oraons.dll".

Can anyone please help ?

The code is pretty straight forward:

  string oradb = "";
  oradb = "Data Source=MYORADB;Password=MYPASS123;User ID=MYUSERID;";
  OracleConnection conn = new OracleConnection(oradb);
  conn.Open(); 

I have already connected TOAD with these credentials.

2

2 Answers 2

1

For me, the solution was to go to the Oracle website where I downloaded and installed the latest version of the Oracle Data Access Components (ODAC).

You'll want to be careful to install the correct version for your programming environment. In my case, it was version 12c (64-bit).

From there, I redirected the Oracle.DataAccess.dll reference to the version that I'd just installed.

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

Comments

0

You don't seem to have a database IP or port number there. Once you have those available, try using the Oracle EZCONNECT format:

//Check that MYORADB is your actual SID number
string oradb = getConnectionString("10.1.2.3", 1521, "MYORADB", "MYUSERID", "MYPASS123");
OracleConnection conn = new OracleConnection(oradb);
conn.Open(); 

private static string getConnectionString(string databaseIP, int databasePort, string databaseSID, string databaseUN, string databasePW)
{
    return string.Format(
        "Data Source=(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = {0})(PORT = {1}))(CONNECT_DATA =(SID = {2})));" +
        "Persist Security Info=True;User ID={3};Password={4}",
        databaseIP, databasePort, databaseSID, databaseUN, databasePW
    );
}

4 Comments

still no luck - does it has anything to do with version of Oracle client compatibility with the Oracle server? I am using Oracle Client version 11g but my server is 10g.
Not sure if the version difference is the culprit, but one other idea. First, create folder C:\OracleClient, place oraons.dll in it, and add C:\OracleClient to your Windows PATH variable (use Google if you aren't familiar with how to do that). If that doesn't work, I'd Google "ons_subscriber_cancelcallback" until you find something that works. I feel your pain- it took me days to get Oracle working with my C# app. Be persistent and you'll get it working!
I got over it. Actually, I had multiple Oracle Client versions installed on my machine for 11g and 12c. Uninstalled both of them, rebooted the machine. Just installed Oracle Client for 12c and the error was gone. Thanks for the help.
Well done! Welcome to the "I got Oracle working on C# and survived" club.

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.