Connection to DB2 using a routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Connection to DB2 using a routine

Post by abhilashnair »

I need to connect to the DB2 using a routine
and then fire a query "select * from schema.table " and write the result to a delimited file
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Write a shell that invokes the db2 connect and runs the query via DSExecute() command. Ofcourse you can make it much easier and use a simple datastage job to do this.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

DSguru2B wrote:Write a shell that invokes the db2 connect and runs the query via DSExecute() command. Ofcourse you can make it much easier and use a simple datastage job to do this.
I need to do this because we are testing whether a routine in DataStage can connect to 64 bit DB2 server. The DataStage client is a 32 bit application.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Haven't we already had this conversation? A 32bit application can connect to a 64bit database using the 32bit libraries the database provides. Simple. No routine or other shenanigans 'needed'.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pathmaker
Premium Member
Premium Member
Posts: 14
Joined: Wed Dec 07, 2005 7:37 pm

Post by pathmaker »

chulett wrote::? Haven't we already had this conversation? A 32bit application can connect to a 64bit database using the 32bit libraries the database provides. Simple. No routine or other shenanigans 'needed'. ...
DataStage does not support connecting to the 64bit client and this will not work. You can still have a 64bit instance of your database but you must use the 32bit libraries. Having a 32bit client shouldn't be the problem. (other than memory issues)

-pratap
Chotu
Thanks & Regards
Pratap Bhimireddy
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Routine

Post by abhilashnair »

I have written a routine
Equate RoutineName To "ConnectToDB2"
Equate DBNAME TO Arg1
Equate DBSCHEMA TO Arg2
DB2CntCmd = "db2 CONNECT TO ":DBNAME
ResultText = @Null

Call DSExecute("UNIX", DB2CntCmd, ResultText, SystemReturnCode)

If SystemReturnCode <> 0 Then
Ans = "1"
Return(Ans)
End

If SystemReturnCode = 0 Then
Ans = "0"
Return(Ans)
End
----------------------------
It is not working Please let me know why
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Since you've started a new thread for this, answers are over there. I still don't understand why you continue down this path when you've been told several times it is completely unnecessary. At least for the reason you've given. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
abhilashnair
Participant
Posts: 284
Joined: Fri Oct 13, 2006 4:31 am

Post by abhilashnair »

I agree with you
But I have to convince my Lead that we can connect to a 64 bit server using a 32 bit DSjob
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then just do it. Correct your dsenv file so that the 32bit libraries are used for the connection, you'll be fine.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply