I have met a problem with my database (version is Oracle 11g).
What did I want to do?
- i want to use procedures to upload a file to the ftp server.
How did i do?
first , i have download the ftp.pks and ftp.pkb files and I use @**.pks to import this packages.
and then i code the procedures like this:
DECLARE l_conn UTL_TCP.connection; BEGIN l_conn := ftp.login('192.168.1.102', '21', 'tony', 'tony'); ftp.ascii(p_conn => l_conn); ftp.put(p_conn => l_conn, p_from_dir => 'MY_DOCS', p_from_file => 'aaa.txt', p_to_file => 'test_put.txt'); ftp.logout(l_conn); END;
when I run it, the console give me this error information
ORA-24247: network access rejected by ACL ORA-06512: at "SYS.UTL_TCP", line 17 ORA-06512: at "SYS.UTL_TCP", line 246 ORA-06512: at "SCOTT.FTP", line 76 ORA-06512: at line 4
and for this reason, I created the
ACL
rules with the following code:begin DBMS_NETWORK_ACL_ADMIN.CREATE_ACL( acl => 'ftp_conn.xml', description => 'ftp connection', principal => 'SCOTT', is_grant => TRUE, privilege => 'connect'); DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL( acl => 'ftp_conn.xml', host => '192.168.1.102', lower_port => 21, upper_port => 21); end;
But, when I run the ftp code again, it also shows that error, so I want know how to fix this.
ACL
can allow TCP connection, but when i use ftp package and call 'ftp.put
', The console output is
error at 1 line: ORA-29260: network error:not connected ORA-06512: at "SYS.UTL_TCP", line 212 ORA-06512: at "SYS.UTL_TCP", line 432 ORA-06512: at "SCOTT.FTP", line 413 ORA-24247: Network access rejected by acl ORA-06512: at "SCOTT.FTP", line 491 ORA-06512: at line 6