Home > get  [1 example]

Receive a remote file.

 Examples

SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := 'ftp.gnu.org';
  usernm VARCHAR2(80) := 'anonymous';
  passwd VARCHAR2(80) := '';
  lv_local_file VARCHAR2(255)  := 'c:\test_readme.txt';
  lv_remote_file VARCHAR2(255) := '/README';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);
  fclient_p.representationType(fid, fclient_p.getIMAGE_TYPE);
  
  fclient_p.retrieveStream(fid, lv_remote_file, lv_local_file);

  fclient_p.logout(fid);
  fclient_p.remove(fid);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid), 1, 255));
END;
/

If you need to check if retrieveStream is successful add the following snippet of code immediately after the call to retrieveStream: IF fclient_p.getLastResponseReturnCode(fid) = '226' THEN DBMS_OUTPUT.PUT_LINE('Successful'); ELSE DBMS_OUTPUT.PUT_LINE(SUBSTR('Failed, Reason :'||REPLACE(fclient_p.getLastResponse(fid), CHR(10)), 1, 255)); END IF;

 Related Commands
 recv
 
© 1999-2003 Bear Claw Inc.