views:

586

answers:

1

I'm writing a C# application to generate an SSIS package.

Part of this involves adding database connection managers - using the library Microsoft.SqlServer.Dts.Runtime. The following line of code shows how this can be done:

ConnectionManager cm = pkg.Connections.Add("OLEDB");

In the above code, I am adding an OLEDB connection, which creates a connection with the provider "Native OLEDB\SQL Native Client".

I do not want this, I am wanting to have the provider Oracle Provider for OLEDB instead.

The following sites show the different connection manager types:

http://msdn.microsoft.com/en-us/library/ms136093.aspx

http://msdn.microsoft.com/en-us/library/ms140203.aspx

But none suggest being able to use the Oracle OLEDB Provider, and the Oracle type specified on the second link is only valid for SQL 2008.

Am I going to have to go down the route of developing my own custom manager as described here?: http://msdn.microsoft.com/en-us/library/ms403359.aspx

Any help would be appreciated

James

+3  A: 

You have to set the connection string on the OLEDB connection to tell it to use the Oracle provider similar to below:

Package pkg = new Package();
ConnectionManager manager = pkg.Connections.Add("OLEDB");
manager.ConnectionString = "Data Source=DEVORA.my.OracleDB;User ID=oracleUser;Provider=MSDAORA.1;Persist Security Info=True;";
manager.Name = "OracleDev";

Obviously you would have to build yourself a valid connection string for your environment (hint: construct one in SSIS designer first and pick out its connection string)

Is this what you were looking for? Let me know if I am off the mark and I will try to revise appropriately

Simon Wilson
Brilliant (although, I was secretly going for the tumbleweed badge ;-). Thanks for your help.
James Wiseman