Cannot bulk load because the file could not be opened. Error code 3

  • I am using FILESTREAM to store PDF documents in a table. I let the user select the PDF to store and then use this code to upload it:

    UPDATE ClaimDocuments

    SET doc_file = (SELECT BulkColumn FROM OPENROWSET(Bulk N'<<file name>>', SINGLE_BLOB) AS BLOB)

    WHERE doc_PK = '<<document Primary Key>>'

    The file is on the users PC in their My documents folder. The user is connected to the database using Windows authentication and the user has Bulk admin rights on the database. The SQL Server process is using the Network Service built in account.

    I am assuming this is a problem with the Network Service not having read rights on the PC's folder where the file is being loaded from. How should I get around this?

  • error code 3 is actually 'The system cannot find the path specified' rather than a permissions error.

    ---------------------------------------------------------------------

  • Frank Cazabon (8/9/2011)


    I am using FILESTREAM to store PDF documents in a table. I let the user select the PDF to store and then use this code to upload it:

    UPDATE ClaimDocuments

    SET doc_file = (SELECT BulkColumn FROM OPENROWSET(Bulk N'<<file name>>', SINGLE_BLOB) AS BLOB)

    WHERE doc_PK = '<<document Primary Key>>'

    The file is on the users PC in their My documents folder. The user is connected to the database using Windows authentication and the user has Bulk admin rights on the database. The SQL Server process is using the Network Service built in account.

    I am assuming this is a problem with the Network Service not having read rights on the PC's folder where the file is being loaded from. How should I get around this?

    if the filename is using a drivename, ie C:\pathToFile\Filename, the file has to exist on the server.

    if the filename is using a UNC path, like \\UserMachine\C$\PathToFile\filename, then the account that is running the SQL server Service needs access to that specific path.

    if it's a shared mapped drive, like M:\ that is on a network share, the same issue above exists...mapped drives require an AD login, and the service running SQL might not have that

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Ah! Thanks, I'll see if I can convert the file name to a UNC and pass that instead

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply