Page 1 of 1
ConnectToDB2 routine
Posted: Mon May 21, 2007 5:53 am
by abhilashnair
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
Posted: Mon May 21, 2007 6:00 am
by ray.wurlod
Code: Select all
Call DSLogWarn(ResultText, "Problem connecting")
Posted: Mon May 21, 2007 6:29 am
by chulett
In other words,
you need to have the routine tell you what went wrong. Plus... Where is DBSCHEMA being used? What user/password is it connecting as?
![Confused :?](./images/smilies/icon_confused.gif)
Posted: Mon May 21, 2007 8:51 am
by abhilashnair
Hi Craig
It would be very helpful if you could rewrite that routine for me
Posted: Mon May 21, 2007 9:27 am
by chulett
I'm sure it would. However, I don't know DB2 and don't have access to it in my environment. What did your DSLogInfo message show?
Posted: Mon May 21, 2007 9:42 am
by abhilashnair
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 "
Posted: Mon May 21, 2007 9:45 am
by abhilashnair
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 .
Posted: Mon May 21, 2007 2:55 pm
by ray.wurlod
Make sure the 32-bit libraries appear ahead of the 64-bit libraries in your shared library search path.
Posted: Tue May 22, 2007 8:07 am
by DSguru2B
...which was advised in the very first place. And if you do that, then even your DB2 stage will work. No need for a routine.
Posted: Tue May 22, 2007 8:26 am
by chulett
It has been
repeatedly advised.
![Confused :?](./images/smilies/icon_confused.gif)