image: image field
Adding an image field to an Access database
R E L A T E D   C O N T E N T
ADVERTISEMENT

Hands on: Access all images

A picture is worth a thousand words, but takes up considerably more storage space

Mark Whitehorn, Personal Computer World 07 Jan 2008
ADVERTISEMENT

Storing images in databases is getting more popular.

For example, I’m currently developing a database at Cambridge University which is storing digital images of Charles Darwin’s herbarium specimens.

We are using Access as the front end and SQL Server as the back end.

Ultimately these will be made available to anyone with a browser. And it’s not just academics, everyone is doing it.

People store ID pictures, images of products, the list is endless. So, what options do you have? There are several ways to store images in a database. I’ll illustrate them in Access but they are true (with variations) for a number of different engines.

Images in the database
Of course, just as text needs to be stored in a text field and dates in a date field, an image needs a special field type. In SQL Server it is called ‘Image’ but in other engines it can have other names including the glorious Blob (Binary Large Object) data type.

In Access images are stored in an OLE Object field. The pros and cons of this choice are very well summed up (for those who are interested in the detail) here.

One problem with saving images as OLE objects is that the Access database inflates faster than a fat cat’s salary. To quote from the article above: “However, this method can rapidly inflate the size of your database and cause it to run slowly. This is especially true if you store GIF and JPEG files because OLE creates an additional bitmap file that contains display information for each of your image files.

“Those additional files can be larger than your original image and thus bloat your database. Keep in mind that Access databases have a 2GB size limit. If you have a large number of images, you can reach that limit quickly.”

In other words, adding a 1MB image may well expand the database by considerably more. So, beware the bloat but, on the other hand, this is a very handy way of storing a limited number of images. And, of course, if you move the database, the images come too; which isn’t true in the next option.

Pointing to images
For this you still use the OLE Object data type but you choose the ‘link’ option when selecting the image (see the practical steps that follow). The image is not copied into the database; all that is inserted into the database is a link to the image.

This, again, has pros and cons. On the pro side, the database bloat is much reduced for obvious reasons. If you edit one of the image files that are stored on the disk, that change is visible if you look at the image from within the database; since the two are one and the same. This ‘feature’ can be either a pro or a con, depending on the functionality that you want.

However, if you move the Access file to another computer, the images don’t travel with it. It can also be difficult to update the link between the two since the pointer to the image (for example, C:\MyPics\Hols\ BrianBeingSilly.JPG), which must be stored somewhere in Access, is not readily available for editing.


All Software Applications
Tags: Databases

Like this story? Spread the news by clicking below:

Post this to Delicious del.icio.us    Post this to Digg Digg this    Post this to reddit reddit!

Permalink for this story
R E A D E R   C O M M E N T S
M A R K E T P L A C E
Get your free demo of Numara Track-It! 8 - the leading help desk solution for IT related issues.
Make presentations, review documents & share your entire desktop. 30-day free trial! (cc required).
Discover how remote support can fuel your IT business in ways you've never thought of before.
Apply ITIL best practices at your service desk while eliminating integration cost. Learn more here.
WAN based, automated, daily vulnerability assessments. Click here to try and request our whitepapers.
Have your product or service listed here >   
Sponsored links
F E A T U R E D   J O B S
Leek Wootton, United Kingdom | Warwickshire Police
 IT Business Analyst - Leek Wootton, Warwickshire - £29,112 - £31,491 PA - 37 hrs per week   Everyone who works for Warwickshire Police helps to protect our communities from harm. Work with us and ... more >
London, United Kingdom | British Museum
Senior Programmer - The British Museum - £40k+ - London   Although steeped in history, the British Museum is constantly striving to improve access to and understanding of one of the world's most diverse collections of antiquities from cultures ... more >
Reading, Berkshire, United Kingdom | EDS
Job Title Netcool Designer / Engineer Location Reading Short Description: DII The DII project is contracted to supply both hardware and software infrastructure solutions to support the MoD transition to a common base solution, based ... more >
Guildford, Surrey, United Kingdom | Enstar
 IT Development Manager/IT Development Project manager - Guildford - £40k - £60 plus benefits   Enstar (EU) Limited (formerly Castlewood (EU) Limited) is seeking an IT Development Project Manager and an IT Development Manager to ... more >
More job opportunities