I am trying to connect oracle server by C# in SSIS script task and run some select/insert queries there. But even I added Oracle.DataAccess.dll, it is still failing because of assembly issue. BTW, Execute sql task can connect to oracle server with same connection string. Here is code that i use for connect:
class Ora
{
OracleConnection con;
public void Connect()
{
con = new OracleConnection();
con.ConnectionString = "Data Source=ServerName;User ID=UserID;Provider=OraOLEDB.Oracle.1;Persist Security Info=True;Password=pass";
con.Open();
Console.WriteLine("Connected to Oracle" + con.ServerVersion);
}
public void Close()
{
con.Close();
con.Dispose();
}
}
public void Main()
{
// TODO: Add your code here
Ora ot = new Ora();
ot.Connect();
ot.Close();
Dts.TaskResult = (int)ScriptResults.Success;
}
And I am getting below error:
An exception of type 'System.IO.FileNotFoundException' occurred in ST_c321d7d567aa46c7bad48f7f0d92bed5 but was not handled in user code
Additional information: Could not load file or assembly 'Oracle.DataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The system cannot find the file specified.