This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

How to Retrieve image from mysql database to table created in jsp page  RSS feed

 
Greenhorn
Posts: 4
C++ Java Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here in this code I am trying to retrieve MySQL database contents such as "images, id, product details " into table created on JSP page. But on compilation it shows: "  Unknown column 'id' in 'where clause'  " message. I have tried a lot but, unable to  retrieve image  from database to table created in JSP page.The image stored in database is Blob image. Can anyone guide me how to retrieve images one after one in table from database to JSP page. Thanks in advance.


-------------------------------------------------------------------------------
Product-IdProduct ImageProduct NameDiscountTotal Price
1Blob imageARM0.527000.00
2Blob imageArduino0.12300.00
3Blob imagePIC microcontroller052500.00

--------------------------------------------------------------------------------
Message: Exception:Unknown column 'id' in 'where clause'
 
author & internet detective
Marshal
Posts: 38502
653
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your table, the column is named "Product-ID", but in the SQL, it is "id". These need to be the same.

Also, note that having Java code (like JDBC) in a JSP is a really old/bad practice.
 
Rancher
Posts: 3595
39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Jeanne says, you don't have an 'id'column in your database table.  You haven't shown us the table itself, but you later try and extract a prod_id from result set, so maybe that's the actual name?

As for the image, you cannot place the image on the page as a single action like this.
HTML does not work like that.
What you need to do is place an <img> tag whose src attribute points to a servlet on your server whose job is to return images.  That servlet will accept the prod_id(?) in the request and pull the BLOB from the db for that row and stream it back.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!