Hi Guys, Im facing an issue in my application with xp_read_file. the procedure returns null incase of a Network path. My application is huge and we can not run this as a service or as another user or apply workarounds given above. Do we have any solution to this problem in Sybase 12 driver version or a better work around please? regards, Wasim |
I infer from your question that you are not running the database server as a service. As Justin noted, paths used by xp_read_file are relative to the user & machine where the server is running. If that is what you are trying to do and it is still not working, consider that it could also be an escaping issue: xp_read_file( '\\server\network_share\foo.txt' ) has a carriage return in the middle of it and isn't actually a UNC name. The path will get translated to "\server[carriage-return]etwork_share\foo.txt" by the SQL parser. 2
...so the solution would be to escape all backslashes correctly (by doubling them...): xp_read_file( '\\\\server\\network_share\\foo.txt' )
(07 Aug '12, 09:39)
Volker Barth
Replies hidden
|
xp_read_file() is something done by the database engine (NOT the client application) - it has to operate with the user rights granted by the operating system to the user account that it is running under. If you want the database engine to be able to access files on a network path, the user credentials that the database engine is running under, has to have read access to that path - nothing is going to be able to get round that. The choices are either to:
You don't say which operating system you are using on your database server, but if it's Windows (of any flavour) remember that the local system account has no network access at all by default. UPDATE - I've just seen the other thread on this question, but it doesn't change what will be the basic problem here. The best thing is probably start with the simplest possible example of what you are trying to do - and work up from there. |