Skip to Content
0

Read Client from Stored Procedure getting an error

May 30, 2017 at 06:25 AM

215

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Volker Barth May 30, 2017 at 07:50 AM
0

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...

Show 2 Share
10 |10000 characters needed characters left characters exceeded

How do I register a callback function and can I do it from within a stored procedure

0

There seems not documentation on that topic, cf. that external link with as sample by Mark Culp.

That being said, using a general callback is documented here. In my understanding, registering that particular callback is done similar.

What I can't tell is how to use a C-based callback function from within PowerBuilder.

I'd highly recommend to ask that in the separate SAP SQL Anywhere Forum because there are SQL Anywhere engineers involved also familiar with PowerBuilder (and more general contribution than here anyway...).


0
Terry Hastings May 30, 2017 at 11:21 PM
0

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

Show 1 Share
10 |10000 characters needed characters left characters exceeded

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

0
Volker Barth Jun 02, 2017 at 08:03 AM
0

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...)

Share
10 |10000 characters needed characters left characters exceeded
Chris Keating
Jun 02, 2017 at 03:54 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Thomas Duemesnil Jun 09, 2017 at 10:24 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded