I try to connect to an Oracle database, but when the code executes the line:
con = new OracleConnection(oradb);
He gives this error. "The program cannot start because oraons.dll is missing on your computer. Try reinstalling the program to fix this problem." I installed ODP for .net on my computer from the next site http://www.oracle.com/technetwork/topics/dotnet/index-085163.html and referenced Oracle.DataAccess.
I also checked the installed folder and I see the oraons dll in the folder. Here is the code:
class OracleDatabase { OracleConnection con; public void ConnectToOracleDb() { string oradb = getConnectionString("host", 1521, "sid", "user", "pass"); try { con = new OracleConnection(oradb); con.Open(); Console.WriteLine("Connected to Oracle" + con.ServerVersion); } catch { Console.WriteLine("Could not connect to FLX"); } } 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 ); } }
Why can't I connect any offers?
c # database oracle11g database-connection
kknaguib
source share