Tuesday, March 20, 2012
Calling DB2 Stored Procedure From SQL Server Store Procedure
one of our larger clients asking for something which I consider a little
bizarre, but a lot of the requests we get from clients fall into that
category.
Anyway, this client wants to know if we can write an SQL Stored Procedure
for them that will connect to DB2, and once connected, execute a DB2 stored
procedure.
Our database department is primarily tasked with DB installations, but we
asked them anyway. They have no idea, and neither do none of us, but our gut
reaction is No. But, before going back to our client with a "No", I thought
I'd run this by the real experts.
Does anyone know if this can be done, and if so, how?
Also, if it can't be done, why not? (we need to respond to the client on
this request.)
Thanks.I see no one has answered you yet - well - it was worth a shot...
See you on the other side!
"RMGGray" wrote:
> I'm a commerical software developer. My company has received a request from
> one of our larger clients asking for something which I consider a little
> bizarre, but a lot of the requests we get from clients fall into that
> category.
> Anyway, this client wants to know if we can write an SQL Stored Procedure
> for them that will connect to DB2, and once connected, execute a DB2 stored
> procedure.
> Our database department is primarily tasked with DB installations, but we
> asked them anyway. They have no idea, and neither do none of us, but our gut
> reaction is No. But, before going back to our client with a "No", I thought
> I'd run this by the real experts.
> Does anyone know if this can be done, and if so, how?
> Also, if it can't be done, why not? (we need to respond to the client on
> this request.)
> Thanks.
calling DB2 store procedures from SQL Server 2000
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
Thursday, March 8, 2012
Calling a AS400 (IBM DB2) Stored Procedure from within SSIS Package
Hi:
I would like to find out how would I call an AS400 (IBM DB2) iSeries Stored Procedure from within my SSIS Package. What tasks should i be using? and do I need any additional adapters installed on my machine to access AS400(IBM DB2). Thanks.
MA
--Run this scrpit, AS400 is the name of your AS400 name
EXEC master.dbo.sp_addlinkedserver @.server = N'AS400', @.srvproduct=N'DB2 UDB for iSeries', @.provider=N'MSDASQL', @.datasrc=N'AS400', @.catalog=N'AS400DBNAME'
-- It will create a linked server name AS400, dtascrc parameter is the name of ODBC_DSN
--Open this linked server and add the UserID/Password--
Once this is done, then use the following to call the stored proc
Exec ('Call Library.StoredProc (?)') AT AS400
Task Name is Execute SQL Task, iSeries Navigator/drivers should be installed on the server.
This is very good article on this
http://www.mcpressonline.com/mc/.6b344718
Wednesday, March 7, 2012
call db2 stored procedure
use linked server..
example:
EXEC sp_addlinkedserver @.server='DB2',
@.srvproduct='Microsoft OLE DB Provider for DB2',
@.catalog='DB2',
@.provider='DB2OLEDB',
@.provstr='Initial Catalog=PUBS;Data Source=DB2;HostCCSID=1252;Network Address=XYZ;Network Port=50000;Package Collection=admin;Default Schema=admin;'
EXEC sp_addlinkedsrvlogin 'DB2', 'false', NULL, 'DB2User', 'DB2Password'Then use OPENQUERY function to call your target DB2 objects..See more on online book about Linked Server.|||Thanks for the update. I see examples of using openquery with db2 select statements but couldn't find any that called a stored procedure with input and output procedures. Is there another function that should be used? Thanks|||Are there any examples of calling a db2 stored procedure with input and output parameters? Should I use the {call format. are there any examples for that? Thanks