Connecting to a remote DB on a UNIX server with SQL

Tags:
DB2
Remote access
SQL database replication
Unix Servers
I am trying to connect to a remote DB on a UNIX server. I am using embedded SQL statements to achieve this task. I have a file that contains DB name, ID & PW that I pass to the connect statement, rather than hardcoding the info to the program (for security reasons). C EstConnect BegSr * C Eval NumAtmpts = 0 C Eval Connected = No * C DoW NumAtmpts <= 3 * THIS CODE ERRORS OUT IN DEBUG SQLCOD = SQL0113 or SQL0188 C/EXEC SQL C+ CONNECT TO :Db USER :Id USING :Pw C/END-EXEC * THIS CODE ERRORS OUT IN DEBUG SQLCOD = SQL0113 or SQL0188 I ALSO TRIED SUBSTRINGING THE CONNECT STATEMENT AS: CONNCT = “CONNECT TO QATMDM USER EDITST USING xxxxxxx” WITH THE SAME ERROR RESULT DOES THE PASSWORD NEED TO BE ENCRYPTED, AND IF SO HOW IS THAT DONE??? C If SQLCOD = NoSqlError OR C SQLCOD = Con_Exists C Eval Connected = Yes C Leave C EndIf * C Eval NumAtmpts = NumAtmpts + 1 * C Enddo C *INZSR BegSr C Move ' ' WRTHDR 1 * C *ENTRY Plist C Parm INVALS 23 C Parm GIS 1 C Parm RTNCDE 1 C Parm TYPE 2 C Parm APPC 20 * C MDMKEY KLIST C KFLD TRXST 5 * C VNDKEY KLIST C KFLD TYPE C KFLD APPC * C SQLKEY KLIST C KFLD TRXST C KFLD APPC C KFLD TYPE * C Movel '852' TRXST C MOVEL INVALS INVAL C MDMKEY CHAIN EMDMCTL C IF %FOUND C Qte CAT EMCPW WrkPw C CAT Qte:0 WrkPw C Eval WrkPw = %Trim(WrkPw) C Eval Pw = WrkPw C Eval Db = EMDBNM C ENDIF C If GIS = 'Y' C OPEN EO852GIS C Else C OPEN E852HDRX C OPEN E852DTLX C OPEN E852ZAX C OPEN E852SDQX C Endif C EndSr ****************** End of data **************************************** Here is the code that I put in to concatenate the CONNCT string... C IF %FOUND C CONECT CAT EMDBNM:1 CONNCT C CAT 'USER':1 CONNCT C CAT EMCID:1 CONNCT C CAT 'USING':1 CONNCT C CAT Qte:0 WrkPw C CAT EMCPW:0 WrkPw C CAT Qte:0 WrkPw C CAT WrkPw:0 CONNCT The code below that is COMMENTED OUT was the first attempt to get this to work. C* Eval Db = EMDBNM C* Qte CAT EMCID:0 WrkId C* CAT Qte:0 WrkId C* Eval WrkId = %Trim(WrkId) C* Eval Id = WrkId C* Qte CAT EMCPW:0 WrkPw C* CAT Qte:0 WrkPw C* Eval WrkPw = %Trim(WrkPw) C* Eval Pw = WrkPw C ENDIF

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following