Monday, July 27, 2009

(Q&A) Can I connect to another AS400 file with embedded SQL in RPGLE?

(From : Anonymous)

If you are going to connect to a local database you can use CONNECT RESET SQL statement, but if you want to connect to another database/machine, you can connect to the desired machine by replacing the RESET parameter with the name of the remote database.

4 comments:

  1. You don't actually need the CONNECT RESET if you are embedding in RPGLE.

    ReplyDelete
  2. ...because if you use the CONNECT RESET, and you get a successful connection, you are going to close all open cursors, destroy all prepared statements and release all locks from the current connection. Do you want that?

    ReplyDelete
  3. If you are going to use SQLRPG, you need to execute CONNECT RESET at the start of your program. And I think embedded SQL is considered as job level, so it won't affect any other jobs.

    ReplyDelete
  4. please site a sample code...tnx!
    what is the difference if I do the RESET or not?

    ReplyDelete