PL / SQL FTP API二进制与ascii模式 [英] PL/SQL FTP API binary vs ascii mode

查看:125
本文介绍了PL / SQL FTP API二进制与ascii模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已成功编译来自Oracle的软件包和包体由Tim Hall给出

我的本​​地服务器中有一个.txt文件,它将在远程服务器中传输:
它运行成功并在远程服务器中获得了相同数据中的文件
,当我以二进制模式运行时:

 
上设置serveroutput DECLARE
l_conn UTL_TCP.connection;
BEGIN
L_CONN:= FTP.LOGIN('192.168.x.y','21','username','pass');
ftp.binary(p_conn => l_conn);
ftp.put(p_conn => l_conn,
P_FROM_DIR => 'MY_DIRECTORY',
p_from_file => '的test.txt',
p_to_file =>test_put 。文本');
ftp.logout(l_conn);
END;
/
完成的匿名区块
220(vsFTPd 2.0.5)
331请指定密码。
230登录成功。
200切换到二进制模式。
227进入被动模式(192,168,1,232,35,205)
150确定发送数据。
226文件接收确定。
221再见。

但是当我运行 ftp.ascii 模式,
它也可以成功运行:

  200切换到ASCII模式。 

但远程服务器中的最终输出看起来像

 `````````````````````` -   -   -   -   -   -   -   -   -   -   - ã㜜㸸...''''''''''¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬ A°¬A°¬A°¬A°¬ãœ¶â¸·å¤·ãœ¹ãŒ³ãŒ³ãŒ³ãŒ³ãŒ¬ã®ãœ±ã¤μ〱ã~¶ã~¶ã~¶ã~¶ã~Šã€±那张±一个个°的³â€±ãºã€°A°â~æ...一个°°â°°â°°â°°A°'㤰ÂμÀ¶ãœ¬ã€¬ä¸¬ä ...'çç©æ¹§æ...¬âääääääääääïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïïï ¤·ãœ¹ãŒ³ãŒ³ãŒ³ãŒ³ãŒ¬ã®ãœ±ã¤μ〱ã~¶ã~¶ã~¶ã~¶ã~Šã€±那张±ãA°的³â€±ãºã€°的±A自动...一个°°°°âââ°°°°A°'㤰ÂμÀ¶ãœ¬ã€¬ä¸¬ä...'ç©æ¹§æ...¬A-A å〜²²¸°$ $ b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b $ b 

我使用ftp ascii模式测试了 cmd 中的相同内容,并且运行得非常好;

如何以ascii模式传输以获取上面的pl / sql中的远程服务器中的实际数据?
在此先感谢:)

解决方案

您是否正在尝试将Linux中的ftp文件转换为windows box?
是文本文件,有英文内容吗?
看起来好像字符集不匹配。



老版本的ftp服务器/客户端仅支持ASCII模式,后来更新为使用UTF-8。
因此,请尝试更新ftp客户端版本。


I've compiled successfully the package and package body from Oracle-base given by Tim Hall,

I've a .txt file in my local server which is to transfer in a remoter server: It successfully runs and got the file in remote server in the same data, when I run in binary mode follows:

set serveroutput on
DECLARE
  l_conn  UTL_TCP.connection;
BEGIN
  L_CONN := FTP.LOGIN('192.168.x.y', '21', 'username','pass');
  ftp.binary(p_conn => l_conn);
 ftp.put(p_conn      => l_conn,
          P_FROM_DIR  => 'MY_DIRECTORY',
          p_from_file => 'test.txt',
          p_to_file   => 'test_put.txt');
  ftp.logout(l_conn);
END;
/
anonymous block completed
220 (vsFTPd 2.0.5)
331 Please specify the password.
230 Login successful.
200 Switching to Binary mode.
227 Entering Passive Mode (192,168,1,232,35,205)
150 Ok to send data.
226 File receive OK.
221 Goodbye.

But when I run in ftp.ascii mode, It also run successfully too:

200 Switching to ASCII mode.

But the final output in the remote server looks like

〱⼱ㄯ㈰ㄳ‱㈺〰㨰〠慭ⰰⰰⰰⰰⰴ㤰㈵〶㜬〬丬䅴瑩湧慬â—ä ­å˜±ã€­å˜²ã„¬ä¸¬å"¬å"¬â°¬â°¬â°¬â°¬ãœ¶â¸·ã¤·ãœ¹ãŒ³ãŒ³ãŒ³ãŒ³ãŒ¬ã ®ãœ±ã¤µã€±ã˜¶ã˜¶ã˜¶ã˜¶ã˜Šã€±â¼±ã„¯ãˆ°ã„³â€±ãˆºã€°ã¨°ã˜ 慭ⰰⰰⰰⰰⰴ㤰㈵〶㜬〬丬䅴瑩湧慬â—ä ­å˜±ã€­å˜²ã„¬ä¸¬å"¬å"¬â°¬â°¬â°¬â°¬ãœ¶â¸·ã¤·ãœ¹ãŒ³ãŒ³ãŒ³ãŒ³ãŒ¬ã ®ãœ±ã¤µã€±ã˜¶ã˜¶ã˜¶ã˜¶ã˜Šã€±â¼±ã„¯ãˆ°ã„³â€±ãˆºã€°ã¨±ãˆ 慭ⰰⰰⰰⰰⰴ㤰㈵〶㜬〬丬䅴瑩湧慬â—ä ­å˜±ã€­å˜²ã„¬ä¸¬å"¬å"¬â°¬â°¬â

I've tested the same in cmd using ftp ascii mode, and runs very well;

How can I transfer in ascii mode to get actual data in the remote server in pl/sql above? Thanks in advance:)

解决方案

Are you trying to ftp files from a Linux to windows box? are the text files, having English content? It so appears like there is a character set mismatch.

The old version of ftp servers/clients supported only ASCII mode, and were later update to work with UTF-8. So, please do try updating the ftp client version.

这篇关于PL / SQL FTP API二进制与ascii模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆