Home > Debugging  [2 examples]

SetDebugger is the subprogram for toggling debug on and off. There are several additional routines for viewing debug messages.

 Examples

Ex. 1. Display all debug messages.
Ex. 2. Control which debug messages can be displayed.


Ex. 1.  Display all debug messages.
--NOTE: When using displayDebugMessages, 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.setDebugger(fid, 1);

  fclient_p.login(fid, host, usernm, passwd);
  fclient_p.logout(fid);

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

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

Output from code above: received response: 220 GNU FTP server ready. sending command: USER anonymous received response: 331 Please specify the password. sending command: PASS null received response: 230-If you have any problems with the GNU software or its downloading, 230-please refer your questions to . 230- 230-There are several mirrors of this archive, a complete list can be 230-found on http://www.gnu.org/order/ft p.html. You might want to use a 230-mirror closer to you. 230- 230-Please note that the directory structure on ftp.gnu.org was 230-redisorganzied fairly recently, such that there is a directory for 230-each program. 230- 230-Note further the non-GNU prog rams that were formerly in gnu/ have 230-moved to gnu/non-gnu/. Most of them were just pointers in the format 230-program.README. If you are looking for such a file, be sure to check 230-gnu/non-gnu/. 230- 230-Archives of the GNU mailing lists can be ac cessed or downloaded 230-via the web from http://mail.gnu.org; they are no longer available 230-by ftp. 230- 230-The FSF provides this archive as a service to GNU users. Please 230-consider donating to the FSF at http://donate.fsf.org/. 230 Login success ful. Have fun. sending command: QUIT received response: 221 Goodbye.


Ex. 2.  Control which debug messages can be displayed.
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.setDebugger(fid, 1);

  fclient_p.login(fid, host, usernm, passwd);

  DBMS_OUTPUT.PUT_LINE(SUBSTR('Last Message: '||fclient_p.getLastDebugMessage(fid), 1, 255));

  fclient_p.logout(fid);

  FOR i IN 0..fclient_p.getTotalDebugMessages(fid)-1 LOOP
    DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_p.getDebugMessageAt(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;
/

Output from code above: Last Message: received response: 230-If you have any problems with the GNU software or its downloading, 230-please refer your questions to . 230- 230-There are several mirrors of this archive, a complete list can be 230-found on http://www.gn received response: 220 GNU FTP server ready. sending command: USER anonymous received response: 331 Please specify the password. sending command: PASS null received response: 230-If you have any problems with the GNU software or its downloading, 230-please refer your questions to . 230- 230-There are several mirrors of this archive, a complete list can be 230-found on http://www.gnu.org/order/ft sending command: QUIT received response: 221 Goodbye.

 Related Commands
 Error Handling
 View Remote Server Responses
 
© 1999-2003 Bear Claw Inc.