views:

152

answers:

1

Hi, could you please help me?

I have an application, in which I BULK INSERT the contents of a csv file into a table through stored procedure. The stored Procedure uses BULK INSERT (SQL Server 2005). This works fine in a standalone system. However when I use the same in a multitier architecture (Web server, Application Server and DB Server) it is throwing 4861 error. Could you please help?

The files are stored on the Web Server.

The translated error message is:

Error – 2147217900:4861: 
Since it can not be opened for the file 
\\Servername\c$\Folder1\Folder2\Folder3\file.csv, 
It can not be loaded with large capacity. 
Operation system error code is 5 (error not ……….)

Thanks
Regards,
Chandru

A: 

That's probably a security issue. If you're running the bulk insert from a SQL Server job, make sure the user account of the SQL Server Agent service has rights to open the file.

If you're running the query from a regular connection, SQL Server will impersonate you and then try to read the file. However, by default, SQL Server is not allowed to act as someone else. See this answer by Remus Rusanu for more details.

Andomar
We are accessing the csv file through stored procedure call from Web application
Chandru
@Chandru: Then it's probably the nasty delegation issue. Answer edited with a link to a good explanation
Andomar