Using SQL Connect Statement in SQLRPGLE

5 pts.
Tags:
CLP
RPGLE
SQL
SQL statements
I need to use the SQL CONNECT statement within a SQLRPGLE program to connect from one AS400 system to another. I need to get data from one file to another. Does anyone know how to do this? Can it be done within a program. I have no trouble when I do it on an SQL command line... I use CONNECT to sys02name user usern using mypassword. Then I use the select statement to get the records I need. If I can do this in an rpg or clp program, that would be helpful. I can't use FTP for this.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Use the WRKRDBDIRE (Work with Relational Database Directory Entries) command to define the data source.

/EXEC SQL

+ CONNECT TO :remotedb USER :userprf USING :passwrd

+ SET CONNECTION remotedb

*** your select statements should work now

/END-EX

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