script component connection maanager
I am using a script component as a data source.<o:p></o:p> I have set up the Connection Manager and used the following script:<o:p></o:p> conn = new MySqlConnection( Connections.Connection.ConnectionString.ToString()); command = conn.CreateCommand(); command.CommandText = "SELECT ID FROM asiarooms.bestdeals_categories"; conn.Open(); reader = command.ExecuteReader();<o:p></o:p> When I run the package an error occurs.<o:p></o:p> "Access denied for user 'xxxx' (using password: NO)...."<o:p></o:p> I know that the connection manager credentials are correct since it is being used successfully in other places.<o:p></o:p> Can anybody help?<o:p></o:p> Mr Shaw
August 3rd, 2012 5:43am

Try connecting to the sql source by creating a sql source connection in the connections manager and using the above user name and password. Check if that works cause it clearly looks like an access issue.http://btsbee.wordpress.com/
Free Windows Admin Tool Kit Click here and download it now
August 3rd, 2012 7:47am

Hi Mr Shaw, The Script component creates a Connections collection class in the ComponentWrapper project item that contains a strongly-typed accessor for each connection manager that has the same name as the connection manager itself. This collection is exposed through the Connections property of the ScriptMain class. The accessor property returns a reference to the connection manager as an instance of IDTSConnectionManager100. Next, you call the AcquireConnection method of the specific connection manager to obtain either the underlying connection or the information that is required to connect to the data source. Fore more details about it, please see: Connecting to Data Sources in the Script Component: http://msdn.microsoft.com/en-us/library/aa337080.aspx Creating a Source with the Script Component: http://msdn.microsoft.com/en-us/library/ms136060.aspx Please feel free to ask if you have any question. Thanks, Eileen
August 11th, 2012 5:44am

This example might be helpful: http://blogs.msdn.com/b/mattm/archive/2008/08/22/accessing-oledb-connection-managers-in-a-script.aspx ConnectionManager cm = Dts.Connections["Restrc_dbconn"]; IDTSConnectionManagerDatabaseParameters100 cmParams = cm.InnerObject as IDTSConnectionManagerDatabaseParameters100; OleDbConnection conn = cmParams.GetConnectionForSchema() as OleDbConnection; Please mark the post as answered if it answers your question | My SSIS Blog: http://microsoft-ssis.blogspot.com | Twitter
Free Windows Admin Tool Kit Click here and download it now
August 11th, 2012 7:24am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics