Code Monkey home page Code Monkey logo

Comments (14)

seek78 avatar seek78 commented on July 25, 2024

UP :-)

from as_sftp.

McMogan avatar McMogan commented on July 25, 2024

Hi Seek,
Have you tried to debug the dbms_lob.getlength( l_file ) in the get_file function to check where the problem come from SFTP transfert or writing file in Oracle Dir ?

from as_sftp.

antonscheffer avatar antonscheffer commented on July 25, 2024

I can't reproduce this problem with the information you have supplied :)

from as_sftp.

seek78 avatar seek78 commented on July 25, 2024

Hi Seek, Have you tried to debug the dbms_lob.getlength( l_file ) in the get_file function to check where the problem come from SFTP transfert or writing file in Oracle Dir ?

Hi @mcmorgan, the OracleDir is ok, otherwise the file cannot be created.
I'll try to get the info you ask.

from as_sftp.

seek78 avatar seek78 commented on July 25, 2024

I can't reproduce this problem with the information you have supplied :)
:-D
Hi @antonscheffer, what kind of information do you need?
With the same SFTP user, using a client like Filezilla, I have no transfer problems.
The permissions on the Oracle directory are also appropriately set.

Is there a way to extrapolate useful information to trace the problem?
Sorry for the question but I'm not very experienced in SFTP communications.

Thanks

from as_sftp.

McMogan avatar McMogan commented on July 25, 2024

I think the issue is at line 3569, because the return of get_file is not tested. So even if the function return false, the file will be created

function get_file( i_path varchar2, i_directory varchar2, i_filename varchar2 )
  return boolean
  is
    l_file blob; 
    l_rv boolean;
    l_fh utl_file.file_type;
    l_len pls_integer := 32767;
  begin
    l_rv := get_file( i_path, l_file ); -- l_rv IS NOT TESTED
    l_fh := utl_file.fopen( i_directory, i_filename, 'wb' );

In my version of the function I added

l_rv := get_file( i_path, l_file );
IF NOT l_rv   THEN RAISE_APPLICATION_ERROR(-20099, 'Erreur dans la récupération du fichier'); END IF; 

from as_sftp.

antonscheffer avatar antonscheffer commented on July 25, 2024

Raising an error will not solve the issue (all files are downloaded with length zero).
Maybe comparing results from as_sftp.pwd and as_sftp.read_dir with the path parameter used for as_sftp.get_file might help.

Or see if something like this works
declare
l_file blob;
begin
.... open connection
as_sftp.put_file( i_path => 'small_file.txt', i_file => utl_raw.cast_to_raw( 'just a small test file for testing purposes.
It contains multiple lines.
This is the third.' ) );
as_sftp.get_file( 'small_file.txt', l_file );
dbms_output.put_line( dbms_lob.getlength( l_file ) );
.... close connection
end;

from as_sftp.

McMogan avatar McMogan commented on July 25, 2024

I meant that there should be an error in the logs (debug_msg) because the function get_file return FALSE for any error, then the file is created on oracle Directory with l_fh := utl_file.fopen( i_directory, i_filename, 'wb' );
So I think seek should put a g_log_level > 1 and check the logs, I think he should have a "get_file: not opened"
That's why I placed a l_rv test and a RAISE_APPLICATION_ERROR so I can be sure that any problem will stop my calling processes

function get_file( i_path varchar2, i_file in out nocopy blob )
..
if utl_raw.substr( l_buf, 1, 1 ) = SSH_FXP_STATUS
      then
        debug_msg( 'get_file: not opened' );
        l_idx := 2;
        get_int32( l_idx, l_buf, l_dummy ); -- id
        get_int32( l_idx, l_buf, l_dummy ); -- reason code
        get_string( l_idx, l_buf, l_buf2 );
        debug_msg( utl_i18n.raw_to_char( l_buf2, 'AL32UTF8' ) );
        exit;

from as_sftp.

antonscheffer avatar antonscheffer commented on July 25, 2024

With the default setting of log_level I think those debug_messages should be visible in the dbms_output.
(I need to change that sometime, those messages shouldn't be in the "default" setting. And log_level and the level info, error and debug uses is wrong too :) )

from as_sftp.

abaynehm avatar abaynehm commented on July 25, 2024

Hi Anton

I have same problem with get_file getting zero length.

Any update to resolve the issue?

Thanks

from as_sftp.

antonscheffer avatar antonscheffer commented on July 25, 2024

No, because I still don't know what the cause of the issue is.
It suspect that it might be a (Unix-) rights issue, the "Oracle" user can't read the files. But I'm not sure as I don't get any feedback on this.

from as_sftp.

abaynehm avatar abaynehm commented on July 25, 2024

It worked

I was passing only the folder excluding the file name for the i_path parameter

Thank you for your reply

Thanks

from as_sftp.

balajivamshi avatar balajivamshi commented on July 25, 2024

Hi,

I'm using the Inbound SFTP - where I'm trying to get a file from the client-server. I'm getting an error where I'm able to fetch the file but the content in the file is being replaced with the 'ls' command of that file. Not sure whether it is the 'ls' command or the hidden file content - (.) file - The content is - r . � .. qùsftp_out r!test1.txt .

Has anyone encountered this issue? If not - Please provide me the advice to resolve this issue.

Thanks in advance.

from as_sftp.

balajivamshi avatar balajivamshi commented on July 25, 2024

Hi,

I'm using the Inbound SFTP - where I'm trying to get a file from the client-server. I'm getting an error where I'm able to fetch the file but the content in the file is being replaced with the 'ls' command of that file. Not sure whether it is the 'ls' command or the hidden file content - (.) file - The content is - r . � .. qùsftp_out r!test1.txt .

Has anyone encountered this issue? If not - Please provide me the advice to resolve this issue.

Thanks in advance.

I've got the solution - I just need to change the i_directory path to amend file_name to it - It worked!

from as_sftp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.