Skip to Content
avatar image
Former Member

Read Client from Stored Procedure getting an error

DB Error: SQLSTATE = S1000 [Sybase][ODBC Driver][SQL Anywhere]Client application does not allow transfer of data ('C:\JACK\hyun20160215.txt')

I'm getting this issue when I attempt to run the stored procedure. The documentation that I can gleam suggests setting the allow_read_client_file connection parameter which I have done.

or issuing this command.

int SQL_CALLBACK file_transfer_callback(
void * sqlca,
char * file_name,
int is_write
);


does anyone have an SQL example I can look at to understand ?



Terry

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • May 30, 2017 at 07:50 AM

    Has the according user also been granted the readclientfile authority?

    Does the procedure work when called for that user from DBISQL? (That will ask whether client data access should be denied or allowed.)

    Note, the callback must be used here, because as the docs state:

    Note that in order to allow reading from or writing to a client file from a 
    procedure, function or other indirect statements, a callback function must be 
    registered. The callback function is called to confirm that the application 
    allows the client transfer that it did not directly request.

    DBISQL itself seems to have registered such a callback which instantiates in the mentioned dialog to ask for permission.

    -----

    Aside: I'm posting an "answer" here although it is more or less just a comment - because the comments are hidden by default, which make them go unnoticed too often...

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2017 at 11:21 PM

    The user has readclientfile authority , as far as the dialog goes I haven't seen that occur at any point. I need to call this from within a PowerBuilder application so getting it to work from within DBISQL isn't an issue. If I run the application on the same server as the DB then it works, what I need to be able to do is run it the PowerBuilder app on another machine. Can I set these permissions

    Terry

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I've now seen this dialog, if I run through iSQL even from the other server. What I need is to be able to set this up for a connection from PowerBuilder. Preferably from a stored procedure

      Terry

  • Jun 02, 2017 at 08:03 AM

    FWIW, Terry, I had added another comment on my previous answer - just in case you missed that...

    (I hate to make such comments here (particularly as answer!) but I guess the hidden comment "feature" still is a pitfall...)

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 02, 2017 at 03:54 PM

    You must have the allow_read_client_file not set in the context that the connection is using. Can you please run the following

    select * from sysoption where "option" = 'allow_read_client_file'

    Confirm the number of rows returned - there should be at least one and can be more depending on if it is set at an user level. Please confirm that the rows returned are set to 'On' as required.

    I have confirmed that setting this option publically does not report this error.

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 09, 2017 at 10:24 AM

    When your Database connection is working over ODBC you have to make sure that the ODBC Driver sees the function call to read_client_file() in a Statement. Then the ODBC Driver does all the work for you. No need to have a callback function registered!

    So you can't embed this call in a other Stored Procedure !

    If you can execute this combined statement from your program it can work

    BEGIN
    declare bin long binary;
    set bin = read_client_file('myfile');
    call MyStoredProc(bin);
    END

    HTH

    Add comment
    10|10000 characters needed characters exceeded