Connection to DB2 using a routine
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
Connection to DB2 using a routine
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
and then fire a query "select * from schema.table " and write the result to a delimited file
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
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.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.
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)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'. ...
-pratap
Chotu
Thanks & Regards
Pratap Bhimireddy
Pratap Bhimireddy
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
Routine
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
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
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. ![Confused :?](./images/smilies/icon_confused.gif)
![Confused :?](./images/smilies/icon_confused.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am