Script Task: ADODB Connection And Recordset

Jul 19, 2006

Hi,

I used adodb connection and recordset in script task. but i have an error saying adodb is not defined. how do i add it to reference? or, is adodb can run in script task or only ado.net?

cherrie

View 2 Replies


ADVERTISEMENT

Script Component Has Encountered An Exception In User Code - Object Is Not An ADODB.RecordSet Or An ADODB.Record

Nov 26, 2007

hi have written SSIS script and i am using script component to Row count below my code what i have written. and i am getting error below i have mention...after code see the error
using System;

using System.Data;

using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

using Microsoft.SqlServer.Dts.Runtime.Wrapper;

using System.Data.SqlClient;

using System.Data.OleDb;



[Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]

public class ScriptMain : UserComponent

{

IDTSConnectionManager100 connMgr;

OleDbConnection sqlConn = null;

OleDbDataReader sqlReader;



public override void AcquireConnections(object Transaction)

{

connMgr = this.Connections.MyConnection;

sqlConn = (OleDbConnection )connMgr.AcquireConnection(null);

//sqlConn = (SqlConnection)connMgr.AcquireConnection(null);

}

public override void PreExecute()

{

base.PreExecute();

/*

Add your code here for preprocessing or remove if not needed

*/

OleDbCommand cmd = new OleDbCommand("SELECT CustomerID,TerritoryID,AccountNumber,CustomerType FROM Sales.Customer", sqlConn);



sqlReader = cmd.ExecuteReader();

}

public override void PostExecute()

{

base.PostExecute();

/*

Add your code here for postprocessing or remove if not needed

You can set read/write variables here, for example:

Variables.MyIntVar = 100

*/

}

public override void CreateNewOutputRows()

{

/*

Add rows by calling the AddRow method on the member variable named "<Output Name>Buffer".

For example, call MyOutputBuffer.AddRow() if your output was named "MyOutput".

*/

System.Data.OleDb.OleDbDataAdapter oLead = new System.Data.OleDb.OleDbDataAdapter();

//SqlDataAdapter oLead = new SqlDataAdapter();

DataSet ds = new DataSet();



System.Data.DataTable dt = new System.Data.DataTable();

//DataRow row = new DataRow();

oLead.Fill(dt,this.Variables.ObjVariable);





foreach (DataRow row in dt.Rows)

{

{

Output0Buffer.AddRow();

Output0Buffer.CustomerID = (int)row["CustomerID"];

Output0Buffer.TerritoryID =(int)row["TerritoryID"];

Output0Buffer.AccountNumber = row["AccountNumber"].ToString();

Output0Buffer.CustomerType = row["CustomerType"].ToString();

}

}



}

}
the error
Script component has encountered an exception in user code
Object is not an ADODB.RecordSet or an ADODB.Record.
Parameter name: adodb
at System.Data.OleDb.OleDbDataAdapter.FillFromADODB(Object data, Object adodb, String
srcTable, Boolean multipleResults)
at System.Data.OleDb.OleDbDataAdapter.Fill(DataTable dataTable, Object ADODBRecordSet)
at ScriptMain.CreateNewOutputRows()
at UserComponent.PrimeOutput(Int32 Outputs, Int32[] OutputIDs, PipelineBuffer[] Buffers)
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PrimeOutput(Int32 outputs,
Int32[] outputIDs, PipelineBuffer[] buffers)

thanks
kedarnath

View 4 Replies View Related

Adodb Recordset Problem

Mar 31, 2006

I am trying to access a table that I know exists and has data. But, when I create a recordset and check for RecordCount, I get a result -1 (no records). When I access the same table (using the same program), it reports (and I can view in a dbgrid) 752580 records exist.

Here's some of the code:

The table is originally copied from another database; I use the following code to be sure the previous connection is closed before proceeding.

  If Not adoRS Is Nothing Then
    If adoRS.State = adStateOpen Then adoRS.Close
    Set adoRS = Nothing
  End If
  If Not DbConn Is Nothing Then
    If DbConn.State = adStateOpen Then DbConn.Close
    Set DbConn = Nothing
  End If

Then a new connection (it works) is opened to access the database with the  copied table:

   strDbConn = "Provider=SQLNCLI;Integrated Security=SSPI;" & _
  "Persist Security Info=False;Database=" & strDbName & ";" & _
  "AttachDBFileName=" & DbPath & ";Data Source=.sqlexpress;" & _
  "User Instance=True"

Next I tried to create the recordset:

  Set adoNewRS = New ADODB.Recordset 'Set OHLC recordset
  Set adoNewRS.ActiveConnection = DestDbConn
  adoNewRS.Open TableName, DestDbConn, adOpenDynamic, adLockOptimistic

Next I try to get the RecordCount:

  NumRecords = adoNewRS.RecordCount

At this point, NumRecords (and adoNewRS.RecordCount) = -1 (even tho I know there are 752580 records in the table).

In the adoNewRS.Open statement, I also tried using the following sql statement:

sSQL = "SELECT * FROM TableName ORDER BY [DateTime];"

It also returns a recordcount = -1.

Anybody have clue?

View 1 Replies View Related

Receive Adodb.Recordset From MSMQ?

Feb 6, 2008

I've been trying different things to "READ" the recordset from the "Message Queue". I can read it but with some weird characters. I've tried

ActiveXMessageFormatter

BinaryMessageFormatter

XMLMessageFormatter


So, far I have no luck.

MessageQueue msgQ3 = new MessageQueue("SERVERNM\" + msg.Label, false);

Message msg3 = new Message();

msg3.Formatter = new ActiveXMessageFormatter();
msg3 = msgQ3.Receive(new TimeSpan(0, 0, 30));

byte[] b = new byte[msg3.BodyStream.Length];
msg3.BodyStream.Read(b, 0, (int)msg3.BodyStream.Length); System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();

returnVal = enc.GetString(b);



RESULTS:
I try to convert it to String and then deserialize later but I'm getting some junk.
<?xml version="1.0" encoding="utf-8" ?>

<string xmlns="http://tempuri.org/">5??m.????????#?_?XTG!???????#?_?Xg??c??????? ?<???m????_?X  |?"???????Dw=?????"I?<???m????_?X21? Reply_Code?$??5? MultiEntries?$??7?dName?.$??3? Page_Number?$??1? Number?$??3? Status_Code?$??/?_Name?.$??5? _Address?+$??/? B_City?$$??1? _State?$??-? _Zip?$??A? Bank_Telephone_Num?"$?? ??11  033000333YHONDA2nd street xavier VA 326200000(555) 555-5500</string>

View 1 Replies View Related

Read Table Description Into ADODB.Recordset.

Aug 20, 2003

How do I read the Tables description into ADODB.Recordset and then recreate the Tables+description into a new database from the ADODB.Recordset.

View 1 Replies View Related

Could I Use SQL Select Case .. When... In ADODB.Recordset().open

Jul 20, 2005

Is there any SQL Error?Or I have to use Select case in VB code to control SQL instead.Thank you for any ans.Nuno

View 4 Replies View Related

Temporary Tables Adodb Recordset Error

Feb 23, 2008

Hi,

I am using the following code


I use SQLOLEDB Provider
It is not stored porcedure but program code

create new global temporary table with
CREATE TABLE ##tmp123 (...
create and open a recorsset to populate it as direct table
at the open stage I get the following error: Invalid object name '##tmp123'

How can I get it working?

View 2 Replies View Related

Vista ADODB Recordset Can't Create ActiveX Object

Jul 19, 2007

Somehow, (I think the user ran a registry cleaner) on Vista, I can no longer create an adodb recordset object.



The app is a VB6 app that works fine on my own Vista Ultimate, my XP boxes and about everthing else prior, but not on the one Vista Home Premium.



I get Error 429 ... Cannot Create ActiveX Object when creating a new adodb.recordset object.



I guess what I need is a way to repair the Vista Home-P machine without having to wipe it.



I see that MDAC_Typ is not recommended as a fix.



I'm at a loss on this one.



View 3 Replies View Related

Send Mail Task Problem Using A Combination Of ForEach Loop, Recordset Destination, Execute SQL Task And Script Task

Jun 21, 2007

OK. I give up and need help. Hopefully it's something minor ...



I have a dataflow which returns email addresses to a recordset.

I pass this recordset into a ForEachLoop configuring the enumerator as (Foreach ADO Enumerator). I also map the email address as a variable with index 0.



I then have a Execute SQL task which receives this email address as a varchar variable (parameter 0) which I then use in my SQL command to limit the rows returned. I have commented out the where clause and returned all rows regardless of email address to try to troubleshoot this problem. In either event, I then use a resultset to store the query result of type object and result name 0.



I then pass this resultset into a script variable to start parsing the sql rows returned as type object. ( I assume this is the correct way to do this from other prior posts ...).



The script appears to throw an exception at the following line. I assume it's because I'm either not passing in the values properly or the query doesn't return anything. However, I am certain the query works as it executes just fine at the command prompt.



Try

ds = CType(Dts.Variables("VP_EMAIL_RESULTS_RS").Value, DataSet)



My intent is to email the query results to each email address with the following type of data by passing the parsed data from the script to a send mail task. Email works fine and sends out messages but the content is empty. I pass the parsed data as string values to the messagesource and define the messagesourcetype as a variable in the mail task.



part number leadtime

x 5

y 9

....



Does anyone have any idea what I might be doing wrong?

thanks

John

View 5 Replies View Related

ADODB Connection With SQL2000SP3

Jul 23, 2005

my code is using ADODB connection to connect to SQL (Virtual) Server.the way it being done is (c++):ADODB::_ConnectionPtr m_dbConn;ADODB::_RecordsetPtr m_dbRst;m_dbConn.CreateInstance(__uuidof(ADODB::Connection ));m_dbRst.CreateInstance( __uuidof( ADODB::Recordset ));m_dbConn->ConnectionString=( L"DSN=mydsn" );m_dbConn->Open("","sa","",-1);lately after installing SP3 over SQL2000, it was impossible to connect- the error message showed: login failed for user 'null)'. reason: notassociated with a trusted sql server connection.so i changed the connection string to:m_dbConn-> ConnectionString =(L"DSN=mydsn; UID=sa; PWD=;");m_dbConn->Open("","","",-1);and now it works !!what is the reason for that ?what in sql SP3 interrupt for this kind of connection ?what is the difference ?

View 1 Replies View Related

ADODB.Connection Error '800a0e7a'

Dec 27, 2007

Hi guys,

I am encountered with this error and can't seem to overcome it. Please help


ADODB.Connection error '800a0e7a'

Provider cannot be found. It may not be properly installed.

/Mod.asp, line 148

It is connecting to a server.

Thanks Guys!!!

View 1 Replies View Related

ADODB.Connection Insert Into Sql Server Table

Jun 16, 2006

Hi Experts,


I’m trying to insert a record from Excel [Sheet2$] from Range (“A2”) to Range (“E2”) into a table on MS SQL server:
But I get the following error:

Error-2147217900(The INSERT INTO statement contains the following unknown filed name:’F1’).


Here is the ADODB.Connection:
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’ ’’’’’’’’’’’’’’
Sub DB_con1()


Dim cn As ADODB.Connection
Dim strSQL As String
Dim lngRecsAff As Long
On Error GoTo test_Error

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=D:Book1.xls;" & _
"Extended Properties=Excel 8.0"

'Import by using Jet Provider.
strSQL = "Insert INTO [odbc;Driver={SQL Server};" & _
"Server=titan;Database=dev;" & _
"UID=sa;PWD=welcome1@].abk_import " & _
"Select * FROM [Sheet2$]"
Debug.Print strSQL
cn.Execute strSQL, lngRecsAff ', adExecuteNoRecords
Debug.Print "Records affected: " & lngRecsAff

cn.Close
Set cn = Nothing

On Error GoTo 0
Exit Sub

test_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure test of VBA Document ThisWorkbook"

End Sub


‘’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’’


Thanks in advance for any help.

Regards,

Abraham

View 2 Replies View Related

Fill A Table With Data From A Database Using And Adodb Connection

Feb 19, 2008

Ok, so I can connect to the database without any errors, however im not sure about the syntax for filling a table.  Heres what i have so far in the pageload.  Like i said this all works with out any errors.  Thanks in advance for the help.testDS = New DataSet()
testDataTable = New DataTable("Tbl")testDataTable.Columns.Add("username")
testDataTable.Columns.Add("datecompleted")testDataTable.Columns.Add("lastfive")
testDS.Tables.Add(testDataTable)Me.dgrdSearch0.DataSource = testDS.Tables("Tbl")
 Dim Conn As Object = Server.CreateObject("ADODB.Connection")
Dim strConn = "DRIVER={SQL Server};SERVER=serverName;UID=userID;PWD=password;DATABASE=net"Dim DSNtest As String = strConn
Dim sql As String = "SELECT * FROM Tbl"
 
Conn.open(DSNtest)
 
 
 
Conn.close()

View 1 Replies View Related

ADO Recordset From SQL Task Issue

Nov 29, 2006

Dear Folks,
I have a Foreach Loop that enumerates a set of files from an ADO recordset variable which is populated by a preceding SQL task. The query from the task that populates the recordset returns about 200 rows with one varchar field(a file path). The loop is long running, and so far it errors on the connection string populated by the enumeration variable after about an hour. The timeout for the SQL task is set to zero. Could it be the source recordset variable timing out, or could it be that the recordset is too large?
Thanks,
Chris

View 8 Replies View Related

RecordSet Into A DataFlow Task

Jan 29, 2007

In the control flow I have an "Execute SQL Task" that executes a stored procedure. The stored procedure returns a result set of about 2000 rows of data into a package variable that has been typed as Object to contain the data.

What I have not been able to figure out is how to access the rows of data (in the package variable) from within a data flow task. There does not seem to be a data flow source task to perform that operation.

What am I missing that would make this easy?

...cordell...

View 8 Replies View Related

Unable To Cast COM Object Of Type 'ADODB.CommandClass' To Interface Type 'ADODB._Command'

Dec 20, 2006

I have an application which runs successfully on a couple of my customer's machines but fails on a third. It seems to fail when opening the database:

Unable to cast COM object of type 'ADODB.CommandClass' to interface type 'ADODB._Command'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{B08400BD-F9D1-4D02-B856-71D5DBA123E9}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=false; Initial Catalog=lensdb;Data Source = SQL

Before I got this error I was getting another problem (sorry didn't make a copy of that error's text) that made me think that adodb.dll simply wasn't loaded/registered. I got rid of that error by copying my adodb.dll onto the third machine and running gacutil /i. There is now an entry in winntassemblies for adodb.

Just in case you think it could be an obvious registry problem: when I started getting the current error I thought that maybe the registry needed updating and I merged the following lines into onto the target machine (from my dev machine):

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}]
@="_Command"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOTInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}TypeLib]
@="{EF53050B-882E-4776-B643-EDA472E8E3F2}"
"Version"="2.7"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}]
@="_Command"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}ProxyStubClsid32]
@="{00020424-0000-0000-C000-000000000046}"

[HKEY_LOCAL_MACHINESOFTWAREClassesInterface{B08400BD-F9D1-4D02-B856-71D5DBA123E9}TypeLib]
@="{EF53050B-882E-4776-B643-EDA472E8E3F2}"
"Version"="2.7"


but, no change alas.

All three machines are running Windows 2000.

Any advice would be appreciated.

Thanks in advance,

Ross

View 1 Replies View Related

SSIS Recordset Access Via Script Task

Jul 18, 2007

Hi,



I have found that populating a data table from an SSIS variable (recordset) within a script task works fine first time round but produces no results subsequently:






Code Snippet

Public Class ScriptMain



Public Sub Main()



Dim ad As New OleDb.OleDbDataAdapter



Dim dt1 As New DataTable
ad.Fill(dt1, ReadVariable("myRecordset"))

'below returns count of 5500
System.Windows.Forms.MessageBox.Show("dt1 Count: " + dt1.Rows.Count.ToString)


Dim dt2 As New DataTable
ad.Fill(dt2, ReadVariable("myRecordset"))

'below returns count of 0
System.Windows.Forms.MessageBox.Show("dt2 Count: " + dt2.Rows.Count.ToString)

Dts.TaskResult = Dts.Results.Success



End Sub






Code Snippet

Private Function ReadVariable(ByVal varName As String) As Object

Dim result As Object

Try
Dim vars As Variables
Dts.VariableDispenser.LockForRead(varName)
Dts.VariableDispenser.GetVariables(vars)

Try
result = vars(varName).Value
Catch ex As Exception
Throw ex
Finally
vars.Unlock()
End Try

Catch ex As Exception
Throw ex
End Try

Return result

End Function





Anybody got any ideas?



Phil.

View 8 Replies View Related

Connection For The ADO RecordSet

Apr 6, 2007

Hi! All,

I have an old ado application like following:



pCadoCon = new CADOConnection;

pCadoCon->Open (_T"driver={...A OEM driver...}; UID=..;PWD=....", _T (""), _T (""));

//some OEM driver unlocking code

pCadors = new CADORs;

pCadors->Open (_T"select foo from bar", pCadoCon->m_lpDispatch, eCursor); //SQL: a select statement here



The CADOConnection and CADORs are ADO connection, RecordSet wrapper classes created with ClassWizard.



I successfully open an ADO connection using the OEM driver by this DSN less way, and then passed it to ADO Recordset. From ODBC trace, I found that under the cover of the ADO, this connection is used to execute the select statement, but after that it automatically opens an other connection. I do not know why and is it possible to disable this?

View 1 Replies View Related

ADO.NET Or OLEDB Connection/recordset?

Aug 9, 2007

My package needs to be a High Performance (target: 150,000 rows in 30 minutes) ETL solution. We are using all MS technologies - SSIS, SQL 2005, BIDS, etc. I need to loop the recordset executed by a Stored Proc in a Execute SQL Task in a Source Script Component.

If I use an ADO.NET Connection Manager, here is the code in the Source Script Component Public Overrides Sub CreateNewOutputRows()

Code 1

Dim sqlAdapter As New SqlDataAdapter

Dim dataRow As Data.DataRow

Dim ds As DataSet = CType(Me.Variables.rsSomeResultset, DataSet)


sqlAdapter.Fill(ds)



Iget: Error: System.InvalidCastException: Unable to cast object of type 'System.Object' to type 'System.Data.DataSet'.



Code 2

Dim oledbAdapter As New OleDb.OleDbDataAdapter
Dim dataTable As DataTable

oledbAdapter.Fill(dataTable, Me.Variables.rsSomeResultset)

Error: System.ArgumentException: Object is not an ADODB.RecordSet or an ADODB.Record. Parameter name: adodb



It works all right when I use an OLEDB Connection Manager with the second code sample.



Question: In order to extract the maximum performance, wouldn't it be preferred to use ADO.NET with SqlClient Provider in an all SQL Server 2005 environment? Or will an OLEDB Connection provide comparable or equal performance?

If so, what code can I use? Since the recordset returned by the Stored Proc (in the Execute SQL Task) can only be captured in a System.Object variable and you can only use the overload of the Fill() method of the OleDbDataAdapter to accept an ADO Recordset or Record object.

View 3 Replies View Related

Recordset Limit Per Connection?

Jun 6, 2007

Hi all,



I have recently moved over from SQL Server 2000 to 2005 and am now having an issue with my application with what appears to be, the number of recordsets that I can open/close on a single connection.



Here is a snippet of what I'm doing, in VB 2005 using ADO... (assuming the connection is already open and working)



Dim RS1 As RecordSet.

DIM RS2 As RecordSet

RS1.Open("SELECT...")

Do While Not RS1.EOF

count = count + 1

Console.Writeline(count)

RS2.Open("SELECT...")

..some processing...

RS2.Close

Loop

RS2 = Nothing

RS1.Close

RS1 = Nothing



Now as I said this all works fine when I connect to an SQL 2000 server but on SQL 2005 it bombs out when 'count' is approximately 1940 with an exception saying that the login failed. If I have Server Management Studio open, that connection will then freeze and throw up an error about how only one usage of each socket address is normally permitted - I think thats more a red herring though.



Any ideas? I've been through all the server settings and can not seem to find anything about recordset limits or timeouts. The only way I've been able to get around this problem at present is to open a new connection object for each iteration to be used by RS2.



Thanks everyone. Any pointers would be much appreciated.

View 9 Replies View Related

Cannot Set Connection Property Of Backup Database Task If Connection String Is Customized In Connection Object

Aug 23, 2006

I added a connection (ADO.NET) object by name testCon in the connection manager - I wanted to programmatically supply the connection string. So I used the "Expressions" property of the connection object and set the connectionstring to one DTS variable. The idea is to supply the connection string value to the variable - so that the connection object uses my connection string.

Then I added a "Backup Database Task" to my package with the name BkpTask. Now whenever I try to set the connection property of BkpTask to the testCon connection object, by typing testCon, it automatically gets cleared. I am not able to set the connection value.

Then after spending several hours I found that this is because I have customized the connection string in testCon. If I don't customize the connection string, I am able to enter the "testCon" value in the connection property of the BkpTask.

Is this an intrinsic issue?

View 2 Replies View Related

ADODB.Connection Error '800a0e7a' Provider Cannot Be Found. It May Not Be Properly Installed. Error

Feb 27, 2008

.im trying to run a script. and i get the errror at the topic. what can i do?

my pointed code is:





Code Snippet

Sur.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strMDBPath


im running on windows vista 64x bus.

View 1 Replies View Related

Data Access :: MS Access ADODB Connection To Stored Procedure - Cannot Retrieve Data

Sep 22, 2015

I'm trying to re-write my database to de-couple the interface (MS Access) from the SQL Backend.  As a result, I'm going to write a number of Stored Procedures to replace the MS Access code.  My first attempt worked on a small sample, however, trying to move this on to a real table hasn't worked (I've amended the SP and code to try and get it to work on 2 fields, rather than the full 20 plus).It works in SQL Management console (supply a Client ID, it returns all the client details), but does not return anything (recordset closed) when trying to access via VBA code.The Stored procedure is:-

USE [VMSProd]
GO
/****** Object: StoredProcedure [Clients].[vms_Get_Specified_Client] Script Date: 22/09/2015 16:29:59 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON

[code]....

View 4 Replies View Related

Using Oledb Connection From Connection Manager In Script Task

Aug 9, 2006

Is there anyone who tried to use a connection from connection manager to create a new connection in a script task? Including the password?

Now i passed the connection to the script task and called it in the vb script but then the password is not passed into the connect string.

Im searching for an example that works with passing the password in the connectstring?



Any help will be greatfull.


View 1 Replies View Related

How To Re-use Connection Manager ADO.NET Connection In A Script Task?

Jun 1, 2007

I'm currently using:

Dts.Connections.Item("myADO.NET connection").AcquireConnection(Nothing)Dim conn As New SqlClient.SqlConnection(Dts.Connections.Item("myADO.NET connection").ConnectionString)
conn.Open()

This seems silly, in that I'm not really using the same connection, but using the connection string of a connection that already exists. And, for my purposes, it's not working currently, because I've switched from Windows Authentication to SQL Auth... and the password isn't coming over in the ConnectionString property.How do I re-use the exact same ADO.NET connection I have in my connection manager in a script task? That's the recommended way to go, right?

View 3 Replies View Related

FTP Task Connection Problem

May 25, 2007

Problem: my FTP Connection Manager cannot connect to the FTP service specified in its configuration parameters. When I execute the FTP Task hooked to that connection manager I get the following error:



[FTP Task] Error: Unable to connect to FTP server using "FTP Connection Manager".



When I test the FTP service using FTP from a command prompt on the same workstation using the same parameters it connects just fine.



When I attempt to edit the settings in the FTP Connection Manager, the editor window pops up and then immediately disappears which is another problem. As I watch closely I can see that the username property is set to my domain login, not the value I typed in when I created it.



So I used the property sheet for the manager to set all the parameters correctly. However it still will not connect. Am I missing something? I've seen posts concerning issues connecting to UNIX/LINUX based FTP services. This particular service is hosted on a LINUX box. TIA.

View 1 Replies View Related

FTP Script Task Using Connection On SSIS

Nov 28, 2007

Hi,
under the script that I use for upload file using SSIS asp.net task.


My problem....
If I comment this line
'ftp.SendFiles(files, "", True, False) ' the True makes it overwrite existing

upload made successfull without failure instead If I leave uncomment I got an error but files upload anyway correct.

Someone can give me some explains about this behavior?
TNKS Alen, Italy


------------------
Public Sub Main()
'Create the connection to the ftp server
Dim cm As ConnectionManager = Dts.Connections.Add("FTP")
'create the FTP object that sends the files and pass it the connection created above.
Dim ftp As FtpClientConnection = New FtpClientConnection(cm.AcquireConnection(Nothing))

Try
'Set the properties like username & password
cm.Properties("ServerName").SetValue(cm, "xxxxxx")
cm.Properties("ServerUserName").SetValue(cm, "xxxxx")
cm.Properties("ServerPassword").SetValue(cm, "xxxxx")
cm.Properties("ServerPort").SetValue(cm, "21")
cm.Properties("Timeout").SetValue(cm, "0") 'The 0 setting will make it not timeout
cm.Properties("ChunkSize").SetValue(cm, "1000") '1000 kb
cm.Properties("Retries").SetValue(cm, "1")

'Connects to the ftp server
ftp.Connect()

'****************************************
' Potrebbe servire in futuro la tengo
'****************************************
''Get file listing
'Dim fileNames() As String
'Dim folderNames() As String
'ftp.GetListing(folderNames, fileNames)
''ftp the files
'ftp.DeleteFiles(fileNames)


'Build a array of all the file names that is going to be FTP'ed (in this case only one file)
Dim files(1) As String
files(0) = "\manny-slaveappWorkFACT-FINDERa.txt"
files(1) = "\manny-slaveappWorkFACT-FINDER.txt"

'ftp the file
'I found it by mistake by creating both the FTP connection and task in the SSIS package and it defaulted the remote path setting in the FTP task.
'ftp.SendFiles(files, "", True, False) ' the True makes it overwrite existing file and False is saying that it is not transferring ASCII
ftp.Close()
Dts.TaskResult = Dts.Results.Success

Catch ex As Exception

ftp.Close()
Dts.TaskResult = Dts.Results.Failure

Finally
ftp.Close()

End Try

End Sub

View 6 Replies View Related

FTP Task: Connection Manager Can Not Be Found

Oct 22, 2007

When I try to create an SSIS package with an FTP task, it always fails to compile with the messages:

Error at Package: The connection "" is not found. This error is thrown by Connections collection when the specific connection element is not found.
Error at FTP Task [FTP Task]: Connection manager "" can not be found.
Error at FTP Task: There were errors during task validation.
(Microsoft.DataTransformationServices.VsIntegration)

The item is marked with a circled-X. The tool-tip also agrees: The connection "" is not found.

Using my recreation steps below, I am setting up a connection manager, but it is never found at compile time.


1. Open BIDS, select a new Integration Services project.
2. Drag an FTP task from the toolbox to the Control Flow window.
3. Double-click the FTP task.
4. On the FTP Task Editor window, General page, pull down the FTPConnection property.
5. Select <New Connection...>
6. On the FTP Connection Manager Editor window, enter the servername, port, username and password.
7. Click "Test Connection" to verify connectivity. (It succeeds.)
8. Click OK on the FTP Connection Manager Editor window.
9. Click OK on the FTP Task Editor window.


I'm not using a configuration file or logging provider for this example.
I have also installed SP2 + cumulative update 2.

View 2 Replies View Related

Connection String In Script Task

Aug 24, 2007



hi,

how can i declare my connection string in script task without having it hardcoded?

can I have a sample? i'm connecting to a sql database.

thanks a lot

cherriesh

View 1 Replies View Related

Selecting Connection In Custom Task UI

Nov 2, 2005

Hi there,

View 1 Replies View Related

How To Check The Connection Through SSIS FTP Task

Dec 19, 2007



Hi All,

I am using a SSIS package to import the .xml data file from FTP location and process them into SQL Server DB by using Stored Procedures. I am using FTP Task to retrieve the file from FTP location but it only works when ever internet is available otherwise it fails, I placed this package as a SQL Server Agent Job. Can anybody tell me the way to check the CONNECTION before FTP Task start its process to avoid the errors???

Please see the error below which I get from SQL Server Agent:

"Description: Failed to decrypt protected XML node "DTSroperty" with error 0x80070002 "The system cannot find the file specified.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available. End Error Error: 2007-12-19 04:00:03.66 Code: 0xC001602A Source: AA_Trans Connection manager "FTP Connection Manager" Description: An error occurred in the requested FTP operation. Detailed error description: The password was not allowed . End Error Error: 2007-12-19 04:00:03.67 Code: 0xC002918F Source: FTP AA Transactions Receive FTP Task Description: Unable to connect to FTP server using "FTP Connection Manag... The package execution fails"

Thanks in advance.
Zeeshan.

View 1 Replies View Related

SSIS Scripts Task - Connection Properties

Sep 5, 2006

Hi All,

I am working on a SSIS package which is using a Script task, now I have all the connection properties set up in the .NET script using connection strings, what do I need to do if I have to set this up using a config file or something else which is more secure (I dont want to leave the connection information in the script). Please Advice.

Thanks

View 3 Replies View Related

How Doo I Get Database Connection From SSIS Script Task?

Dec 18, 2007

When I try this code in an SSIS "Script Task":

Dim dbConnectionManager As ConnectionManager = Dts.Connections(0)
Dim dbConnectionRaw As Object = dbConnectionManager.AcquireConnection(Nothing)
Dim dbConnection As OdbcConnection = CType(dbConnectionRaw, OdbcConnection)

I get this error:

Unable to cast COM object of type 'System.__ComObject' to class type 'System.Data.Odbc.OdbcConnection'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.



I'm just trying to get a basic database connection from the DTS package in my
script task. Is there a better way to do this? Preferably, I would use ADO.NET
rather than the old COM stuff. However, if SSIS still requires the use of COM,
that's fine as well, as long as I can fix the above code.

Thanks in advance!

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved