Home > View Remote Server Responses  [2 examples]

Each response that is sent back from the remote server can be viewed by using one or more of the following subprograms:

 Examples

Ex. 1. Display all responses.
Ex. 2. Display individual responses.


Ex. 1.  Display all responses.
-- NOTE: When using displayAllResponses, DBMS_JAVA.SET_OUTPUT must be set.
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := 'ftp.gnu.org';
  usernm VARCHAR2(80) := 'anonymous';
  passwd VARCHAR2(80) := '';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);
  fclient_p.logout(fid);

  DBMS_JAVA.SET_OUTPUT(1000000);
  fclient_p.displayAllResponses(fid);

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


Ex. 2.  Display individual responses.
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
  fid VARCHAR2(80);
  host VARCHAR2(80)   := 'ftp.gnu.org';
  usernm VARCHAR2(80) := 'anonymous';
  passwd VARCHAR2(80) := '';
BEGIN
  fid := fclient_p.createFTPClient;
  fclient_p.login(fid, host, usernm, passwd);

  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Response: '||fclient_p.getLastResponse(fid), 1, 255));
  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Response Code: '||fclient_p.getLastResponseReturnCode(fid), 1, 255));
  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Response String: '||fclient_p.getLastResponseString(fid), 1, 255));

  fclient_p.logout(fid);

  FOR i IN 0..fclient_p.getTotalResponses(fid)-1 LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR('Response #'||i||': '||fclient_p.getResponseAt(fid, i), 1, 255));
    DBMS_OUTPUT.PUT_LINE(SUBSTR('Response Code #'||i||': '||fclient_p.getResponseReturnCodeAt(fid, i), 1, 255));
  END LOOP;
  
  fclient_p.remove(fid);
EXCEPTION
  WHEN fclient_p.java_failed THEN
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getErrorWithResponse(fid), 1, 255));
END;
/

 Related Commands
 Error Handling
 Debugging
 
© 1999-2003 Bear Claw Inc.