ConnectToDB2 routine
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
ConnectToDB2 routine
i have written a routine to connect to db2
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
--------------------------------------------------------------------------------
The Ans=1
Please let me know why is the routine not connecting to DB2
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
--------------------------------------------------------------------------------
The Ans=1
Please let me know why is the routine not connecting to DB2
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Call DSLogWarn(ResultText, "Problem connecting")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
I have modified the routine to
Equate RoutineName To "ConnectToDB2"
Equate DBNAME TO Arg1
DB2CntCmd = "db2 CONNECT TO ":DBNAME
ResultText = @Null
Call DSExecute("UNIX", DB2CntCmd, ResultText, SystemReturnCode)
If SystemReturnCode <> 0 Then
Ans = ResultText
Return(Ans)
End
If SystemReturnCode = 0 Then
Ans = "0"
Return(Ans)
End
This is returning the error as "Could not load the db2 program "
Equate RoutineName To "ConnectToDB2"
Equate DBNAME TO Arg1
DB2CntCmd = "db2 CONNECT TO ":DBNAME
ResultText = @Null
Call DSExecute("UNIX", DB2CntCmd, ResultText, SystemReturnCode)
If SystemReturnCode <> 0 Then
Ans = ResultText
Return(Ans)
End
If SystemReturnCode = 0 Then
Ans = "0"
Return(Ans)
End
This is returning the error as "Could not load the db2 program "
-
- Participant
- Posts: 284
- Joined: Fri Oct 13, 2006 4:31 am
This is the complete error message
Result = Could not load program /db2t/gtstinsa/sqllib/bin/db2:
Could not load module /db2t/gtstinsa/sqllib/lib/libdb2.a(shr_64.o).
Dependent module /usr/opt/db2_08_01/lib/libdb2trcapi.a(shr_64.o) could not be loaded.
Member shr_64.o is not found in archive
Could not load module db2.
Dependent module /db2t/gtstinsa/sqllib/lib/libdb2.a(shr_64.o) could not be loaded.
Could not load module .
Result = Could not load program /db2t/gtstinsa/sqllib/bin/db2:
Could not load module /db2t/gtstinsa/sqllib/lib/libdb2.a(shr_64.o).
Dependent module /usr/opt/db2_08_01/lib/libdb2trcapi.a(shr_64.o) could not be loaded.
Member shr_64.o is not found in archive
Could not load module db2.
Dependent module /db2t/gtstinsa/sqllib/lib/libdb2.a(shr_64.o) could not be loaded.
Could not load module .
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: