This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JSP and the fly likes Inserting & Retrieving Images from MSSQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Inserting & Retrieving Images from MSSQL" Watch "Inserting & Retrieving Images from MSSQL" New topic

Inserting & Retrieving Images from MSSQL

Ola Daniel
Ranch Hand

Joined: Jul 27, 2005
Posts: 105
i am not really sure which forum this should go. Ill try here. I hope I get some direction. I am trying to create a page to upload images to a database and also view this when in the database on one of my JSPs. I am kind of lost. I would appreciate any direction on where to start from - like some kind of reference somewhere.

SCJP 1.4, SCWCD 1.4
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler et al, Refactoring: Improving the Design of Existing Code, 1999
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63870

What part are you having trouble with:

  • Uploading the image?
  • Storing the image in the DB?
  • Reading the image from the DB?
  • Streaming the image to the browser via servlet?
  • Referencing the image in an image tag?
  • All of the above?

  • [ August 29, 2005: Message edited by: Bear Bibeault ]

    [Asking smart questions] [About Bear] [Books by Bear]
    Ola Daniel
    Ranch Hand

    Joined: Jul 27, 2005
    Posts: 105
    I am having trouble reading the Image from the database and streaming the image to the browser. This is the portion of the code that is to retrieve the image from the database.

    11:52:32,591 INFO [STDOUT] java.lang.NullPointerException
    11:52:32,591 INFO [STDOUT] ODD: java.lang.NullPointerException: null

    I am getting the above exception. Help please...

    The plan is to write the image from the DB to a file.png and then set an attribute that can be used by the image tag and display the picture on the jsp.
    [ August 30, 2005: Message edited by: Ola Daniel ]
    Ola Daniel
    Ranch Hand

    Joined: Jul 27, 2005
    Posts: 105
    Guys problem solved.. my page is up an running
    I agree. Here's the link:
    subject: Inserting & Retrieving Images from MSSQL
    It's not a secret anymore!