Showing posts with label component. Show all posts
Showing posts with label component. Show all posts

Tuesday, March 20, 2012

Connection Manager problem in ScriptComponent

Hi,

I am using OleDB source as well as Script component in my package. Both these component are using same database. But as of now I am using two connections for each of this comp as I am unable to make use of the OLE DB connection in script component.

How can I solve this. I mean how can I use the the OLE DB conn which I used in OLEDB Source comp in the Script Component.

Any help will be greatly appreciated.

Thanks

For script component, create and use ADO.NET connection manager.

OLEDB connection is not meant to be used from .NET. If you really need to use it, you should create a custom component in C++, rather than using script component.

Monday, March 19, 2012

Connection Manager ignores expressions with script component

I have written a script source component and attached a flat file connection. The connection string of which is defined by an expression.

However when I get the connectionstring from the connection in the script it has the default filename value of flat file not the value of the expression. This is proved by passing in the filename variable, and comparing the 2.

The flat file has an expression on the ConnectionString of @.[User::filename]

Can someone confirm this is a bug.

Is this any help to you: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=295220&SiteID=1

-Jamie

|||Looks like it, needs some clarification though.

Sunday, March 11, 2012

Connection in transformation component

Hi,

I'm on writing a custom data flow component (transformation). For this I need access to an external datasource. As best practice, it seems that you should use a connectionmanager in the package.

But I don't really know how to access them.

I've overwritten the AquireConnections() to lookup in the RuntimeConnectionCollection for the connection managers. But It seems it doesnt get called. If I call it my own, for example in validate (just for debugging purposes) the collection is empty, although there are two connectionmanagers in the package.

What am I doing wrong or has someone a code snippet for me.

Thanks T.

To make the package connections available within the AcquireConnection or ReleaseConnection method, (make sure you use the latter to close any connection resources), you first have define the component as having one or more connections. You do this in the ProvideComponentProperties method, so just add it and give it a name, description if you feel like it.

IDTSRuntimeConnection90 runtimeConnection = ComponentMetaData.RuntimeConnectionCollection.New();

runtimeConnection.Name = "Reference Data";

This acts as a placeholder, so that if you were to now look at the built-in Advanced UI Editor, on the first page you will see the connection listed, ready for you to choose one of the existing package connections.