1

I have a connection manager that points to an oracle database.I then need to use that said connection into a ssis script task.I don't know how to proceed.I tried something and I got an error message could you help me.Here is my code: I also tried with those connection string:

// SqlConnection conn = new SqlConnection("Data Source=SOURCE;User ID=user_GG;Provider=OraOLEDB.Oracle.1;Persist Security Info=True;");
SqlConnection oracleConn = new SqlConnection("Data Source=PRONMPIA;Persist Security Info=True;Integrated Security=yes;");
oracleConn.Open();

using (SqlCommand command = new SqlCommand("SELECT count(*) FROM random.table", oracleConn))
using (SqlDataReader reader = command.ExecuteReader())
{
    while (reader.Read())
    {
        int name = reader.GetInt32(0);
        MessageBox.Show("SALUT " + name.ToString() );
    }
}
oracleConn.Close();

MessageBox.Show(" test succes");
Dts.TaskResult = (int)ScriptResults.Success;
Halvor Holsten Strand
  • 19,829
  • 17
  • 83
  • 99
Simix48
  • 55
  • 1
  • 10
  • What error message did you receive ? – Nagaraj Tantri May 21 '15 at 03:26
  • (provider: Named Pipes Provider, error: 40 - Impossible to open a connexion to sql server). A error due to network or specific to the instqance happened while trying to establish a connexion to sql server.The server was not found or is not accessible. Sorrry I had to translate the error message. – Simix48 May 21 '15 at 12:26
  • Try troubleshooting via: [how-do-i-fix-the-error-named-pipes-provider-error-40-could-not-open-a-connec](http://stackoverflow.com/questions/9945409/how-do-i-fix-the-error-named-pipes-provider-error-40-could-not-open-a-connec) – Nagaraj Tantri May 21 '15 at 13:08

1 Answers1

3

You are trying to use SqlConnection which is a .Net component for SQL Server, not for Oracle. You need the Oracle.DataAccess.Client and the OracleConnection. To use that you need to add the Oracle .Net provider to the References of the Script task (see project explorer References node when editing the script task .Net code), Add Oracle.DataAccess, then in you code "using Oracle.DataAccess.Client;". HTH

Stefan Over
  • 5,851
  • 2
  • 35
  • 61
Laszlo
  • 31
  • 2