There are two exceptions that can be raised within fclient_p package: /** Raise whenever there is a java problem. */ java_failed EXCEPTION; /** Raise whenever there is a plsql problem. */ plsql_failed EXCEPTION; NOTE: PLEASE DO NOT use PLSQL_FAILED exception, since it is no longer being used and will be removed in a future release. There are two functions that provider error handling: fclient_j.getErrorMessage and fclient_p.getErrorWithResponse. The function getErrorMessage returns an error message when an error occurs. The function getErrorWithResponse returns an error message and the response message from the ftp server. The latter function should be used in most cases to get the most information about an problem that has occured. The exceptions and functions mentioned above provide the error handling mechanism for dbftp.
| Examples |
Ex. 1. fclient_j.getErrorMessage usage
Ex. 2. fclient_p.getErrorWithResponse usage
-- Has an invalid host
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
fid VARCHAR2(80);
host VARCHAR2(80) := 'xyz.xyz.xyz';
usernm VARCHAR2(80) := 'anonymous';
passwd VARCHAR2(80) := '';
BEGIN
fid := fclient_p.createFTPClient;
fclient_p.login(fid, host, usernm, passwd);
fclient_p.logout(fid);
fclient_p.remove(fid);
EXCEPTION
WHEN fclient_p.java_failed THEN
DBMS_OUTPUT.PUT_LINE(SUBSTR(fclient_j.getErrorMessage, 1, 255));
END;
/
Output from example:
UniqueFTPClient.connect: java.net.UnknownHostException:
-- Has an invalid user
SET SERVEROUTPUT ON SIZE 1000000;
DECLARE
fid VARCHAR2(80);
host VARCHAR2(80) := 'ftp.gnu.org';
usernm VARCHAR2(80) := 'xyz';
passwd VARCHAR2(80) := '';
BEGIN
fid := fclient_p.createFTPClient;
fclient_p.login(fid, host, usernm, passwd);
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;
/
Output from example above:
Error Message: Unable to connect
Response: 503 Login with USER first.
| Related Commands |
Debugging View Remote Server Responses© 1999-2003 Bear Claw Inc.