Tuesday, March 20, 2012

calling DB2 store procedures from SQL Server 2000

I am trying to call DB2 stroe procedure from within SQL server 2000 using DTS. I have the IBM odbc driver installed on the server. I have created an ACtiveX script to run in DTS and it fails staing it could not findor load the DB2 store procedure.

Has anyone come across doing this and how they did it?

THanks for the help...How did you connect to DB2?|||I am using ODBC to connect to the DB2 database. I have setup DTS scripts to do inserts into DB2 database with success using the Other ODBC connection.|||Did you try setting up a linked server to DB2?

What platform is DB2 on?

O/S 390? AS400? UNIX?

What version of DB2 (not important, just curious)

You mention stored procedure and DTS...which one are we talking about?

Can you select data from DB2 in QA?|||Yes I do have linked server to the DB2 database.

I am not sure the platform but I believe it is Unix.

The version of DB2 is 8.x

I can select data from DB2 using the OPENROWQUERY statement.

I am using DTS to execute the DB2 Store Procedure.

I also tried to do through an ACtiveX Script:

Here is the script:

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

Dim con, rs, connectstr

Set con = CreateObject ("ADODB.Command")
Set connect1 = CreateObject("ADODB.Connection")

connectstr = "Provider=IBMDADB2.1;Password=xxxxx;User ID=xxxxxx;Data Source=TWDLBS1D;Persist Security Info=True"
'connectstr = "Provider=MSDASQL.1;Persist Security Info=True;User ID=xxxxxx;Password=xxxxxx;Data Source=TWDLBS1D;Mode=ReadWrite"

connect1.open connectstr
con.ActiveConnection = connect1
con.CommandText = "LAWSON.LBS_BATCH_VALID"
con.CommandType = 4 'adCmdStoredProc
'con.Parameters.Append con.CreateParameter (adInteger,adParamInput ,258)
'con.Parameters.Append con.CreateParameter (adDate,adParamInput, "2004/02/04")
'con.Parameters.Append con.CreateParameter (adChar,adParamInput, "NP")
Set rs = con.Execute

Main = DTSTaskExecResult_Success
End Function

No comments:

Post a Comment