Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Image Upload

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-11-30 : 02:24:21
HI
iam using sqlserver 2008.when iam trying to upload the image file in
table it shows the below error:



INSERT INTO DBFiles(fname, [file])
SELECT 'logitech.jpg', * FROM OPENROWSET(
BULK N'D:\images\logitech.jpg',
SINGLE_BLOB
) rs;



error:
Cannot bulk load because the file "D:\images\logitech.jpg" could not be opened. Operating system error code 5(failed to retrieve text for this error. Reason: 15105).



Lumbago
Norsk Yak Master

3271 Posts

Posted - 2010-11-30 : 08:03:16
Are you sure that the image is visible to the sql server in the location you are providing? For sql server to be able to load the file in to a table, the folder you have specified needs to be on the database server and the user running the sql server service account must have read access to this file.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com
Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-12-01 : 09:12:17
image is visible in the location and more over iam using sa account only..


how to check user running the sql server service account must have read access to this file
quote:
Originally posted by Lumbago

Are you sure that the image is visible to the sql server in the location you are providing? For sql server to be able to load the file in to a table, the folder you have specified needs to be on the database server and the user running the sql server service account must have read access to this file.

- Lumbago

My blog (yes, I have a blog now! just not that much content yet)
-> www.thefirstsql.com


Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-12-01 : 12:06:36
quote:
Originally posted by sent_sara

HI
iam using sqlserver 2008.when iam trying to upload the image file in
table it shows the below error:



INSERT INTO DBFiles(fname, [file])
SELECT 'logitech.jpg', * FROM OPENROWSET(
BULK N'D:\images\logitech.jpg',
SINGLE_BLOB
) rs;



error:
Cannot bulk load because the file "D:\images\logitech.jpg" could not be opened. Operating system error code 5(failed to retrieve text for this error. Reason: 15105).





Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-01 : 12:18:54
Is D:\images located on the server machine or is it a folder on your client machine?
SQL Server can't access your client hard-drives.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2010-12-01 : 23:32:35
its is in server machine only
quote:
Originally posted by webfred

Is D:\images located on the server machine or is it a folder on your client machine?
SQL Server can't access your client hard-drives.


No, you're never too old to Yak'n'Roll if you're too young to die.

Go to Top of Page

Sachin.Nand

2937 Posts

Posted - 2010-12-02 : 00:11:20
Right Click the Images folder>>Properties>>Security>> and the Add "EveryOne" and give all the Access to that folder and then try.

PBUH

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-12-02 : 03:07:19
If SQL is configured to allow running xp_cmdshell try

EXEC master.dbo.xp_cmdshell 'DIR D:\images\logitech.jpg'

to see if the file is "visible" to SQL Server, and at that location.
Go to Top of Page
   

- Advertisement -