473,396 Members | 2,020 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Storing pictures in database

Hy, could someone help me in this:

In design mode, i want to put pictures in database. I made column named
pics, and its type as image. How can I put pictures or some address of these
pictures in that column, or i maybe need to put pictures in Add_Data folder
and make reference from there, or what I need to do?

could someone explain me that process of putting at least one picture in
database, I'm using Microsoft SQL Server 2005

thanks everyone
Sep 13 '07 #1
4 7229
"Zeljko Bilandzija" <za*****@email.t-com.hrwrote in message
news:fc**********@ss408.t-com.hr...
Hy, could someone help me in this:

In design mode, i want to put pictures in database. I made column named
pics, and its type as image. How can I put pictures or some address of
these pictures in that column, or i maybe need to put pictures in Add_Data
folder and make reference from there, or what I need to do?
Personally, I prefer to store files in the file system and links to them in
the DB.

On top of that I prefer to use two fields, one a directory and one the name
of the file itself.

Makes it a tad easier to do a mass update if I need to move the directory
(say to a different drive).

>
could someone explain me that process of putting at least one picture in
database, I'm using Microsoft SQL Server 2005

thanks everyone


--
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html
Sep 13 '07 #2
Zeljko Bilandzija (za*****@email.t-com.hr) writes:
Hy, could someone help me in this:

In design mode, i want to put pictures in database. I made column named
pics, and its type as image. How can I put pictures or some address of
these pictures in that column, or i maybe need to put pictures in
Add_Data folder and make reference from there, or what I need to do?

could someone explain me that process of putting at least one picture in
database, I'm using Microsoft SQL Server 2005
The normal way of adding pictures, or any other data for that matter, is
through an application.

But you could use the BULK provider with OPENROWSET. Look at OPENROWSET
in Books Online, and particularly at example D.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Sep 13 '07 #3
Thanks to both of you on help

but i give you example what i'm interesing

i want to put some pictures on server or local disk, and i want make, for
example, column named "Pictures", and store in that column url or path on
local disk, to get that pictures when i refer to particular id in query on
web page. If I can do that in this way, which type of data to choose for
that column (how make that links or paths)

thanks
"Erland Sommarskog" <es****@sommarskog.sewrote in message
news:Xn*********************@127.0.0.1...
Zeljko Bilandzija (za*****@email.t-com.hr) writes:
>Hy, could someone help me in this:

In design mode, i want to put pictures in database. I made column named
pics, and its type as image. How can I put pictures or some address of
these pictures in that column, or i maybe need to put pictures in
Add_Data folder and make reference from there, or what I need to do?

could someone explain me that process of putting at least one picture in
database, I'm using Microsoft SQL Server 2005

The normal way of adding pictures, or any other data for that matter, is
through an application.

But you could use the BULK provider with OPENROWSET. Look at OPENROWSET
in Books Online, and particularly at example D.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx

Sep 15 '07 #4
Zeljko Bilandzija (za*****@email.t-com.hr) writes:
Thanks to both of you on help

but i give you example what i'm interesing

i want to put some pictures on server or local disk, and i want make, for
example, column named "Pictures", and store in that column url or path on
local disk, to get that pictures when i refer to particular id in query on
web page. If I can do that in this way, which type of data to choose for
that column (how make that links or paths)
If you store a URL, then your application will have to connect to a web
service or somesuch to get the picture. Whatever, it's beyond the scope
for this newsgroup. The data type would simply be varchar(500) or what
upper length you want to place on the URL.

If you store the picture on disk, the application must be able to
access the disk the file is on, and normally the client in an client-
server setup does not have access to the disk on the server, only the
server application, in this case SQL Server. And SQL Server is not going
to read the files from disk for you.

Overall, I disagree with Greg's recommendation to store the pictures in
the file system. In SQL 2000 and before, this solution had some attraction
that the data types for large objects (text, next and image) were difficult
to work with. But SQL 2005 introduced replacement for these that are
very simple to work with. And in about all other parts, storing the
images as files in the file system means more work. As I've mentioned,
you need to ensure that clients can access the files. Backups are more
tricky, because you need to backup database + directory. There is also
bigger risks for corruption in the sense that a file could be deleted
from disk, while there is still a path to it in the database.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Sep 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jim S. | last post by:
Hi guys, i have lots of data for products (with different categories) and pictures that i would need it entered into a database on the website. How would i go about doing so? i was thinking...
3
by: bissatch | last post by:
Hi, I am wanting to learn how to store images in a postgreSQL database. I have got as far as uploading the file using a file/browse field on an html form and have been able to catch the file...
4
by: Rednelle | last post by:
Greetings all, As a newbie, using Access 2000, I would appreciate advice on the best way to include pictures. I have developed a 'Home Inventory' database which can include jpeg thumbnails of...
6
by: stenospamron | last post by:
Does anyone have any advice as to how to get JPG images into an OLE Object field? I have created a table that includes this data type, and allowed Access wizzard to generate a form. I wish to...
3
by: T23459 | last post by:
Re: storing jpg images in Access. I have a database that requires adding pictures (jpegs) on a regular basis. OLE field. Even if they are only 320x240 large, I can see - over time, that the amount...
12
by: Wadim Grasza | last post by:
I want to store and display (on a form or a report) multiple pictures per record in an access database. The pictures are not stored within the database. They are stored as files and the database...
2
by: Sourabh Agrawal | last post by:
Dear All, Pls give some idea about storing and retriving images in a MS- Access database using VB6. Thanks Sourabh
1
samycbe
by: samycbe | last post by:
hi, i am using sql server as a backend. i want to store employee photos. How to do? shall i store picure? Otherwise storing the picture in server and path(file name) can be stored? Pls help me.......
1
by: John | last post by:
I need to store a variety of items in SQL Server. These could be text files, pictures, word documents, PDF, etc. I have set up my database to accept a varbinary(max) and I can put the items into...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.