Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
| Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 27th, 2009, 02:11 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default displaying images from database(mysqlquerybrowser) in jsp:)

Hello I am Peggie.
Well, I am a newbie in using jsp. I hope that maybe you guys can provide some samples of displaying images from database(mysqlquerybrowser) in jsp page. I also make use of package to call out the connection.

My database in mysql query browser is called: image

And the attribute is
prodID (INT)
ProdImage(blob)

Thanks:)
Hope to receive reply from you guys soon!
  #2 (permalink)  
Old June 29th, 2009, 12:01 AM
jomet
Guest
 
Posts: n/a
Default

Just google,
you will get many samples. Similar posts are already in this forum.

i think you already know how to connect with mysql
otherwise look,
http://www.roseindia.net/jdbc/jdbc-m...lConnect.shtml

some links for image display,
http://www.theserverside.com/discuss...thread_id=5444
http://fdegrelle.over-blog.com/article-992927-6.html


Last edited by jomet; June 29th, 2009 at 12:07 AM..
  #3 (permalink)  
Old June 29th, 2009, 04:27 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks:)
Oh ya when i try to declare blob at the java page, the 'blob' data type is in error.
Do you guys know how to resolve this?
Thanks:)
  #4 (permalink)  
Old June 29th, 2009, 05:36 AM
jomet
Guest
 
Posts: n/a
Default

Quote:
Originally Posted by Peggie1990 View Post
declare blob at the java page
how you are doing this?
Post the code too..
  #5 (permalink)  
Old June 29th, 2009, 05:39 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Talking

Okay:)
Code:
 
package sg.nyp.edu.sit.model;

public class Image {
int imageID;
Blob image;
public int getImageID() {
return imageID;
}
public void setImageID(int imageID) {
this.imageID = imageID;
}
public Blob getImage() {
return image;
}
public void setImage(Blob image) {
this.image = image;
Code:
}
  #6 (permalink)  
Old June 29th, 2009, 06:33 AM
jomet
Guest
 
Posts: n/a
Default

I don't used java.sql.Blob.
My suggestion is to use a byte array for storing binary data like image.

java.sql.Blob provides methods for conversion.
see
http://db.apache.org/derby/docs/10.0...e/sqlj208.html
  #7 (permalink)  
Old June 29th, 2009, 06:47 AM
Authorized User
 
Join Date: Jan 2009
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks:)

I'll try it:)


Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing images in Database and displaying them Manoj Bisht ASP.NET 1.x and 2.0 Application Design 4 February 6th, 2010 03:06 AM
displaying images embedded in database jia ASP.NET 1.0 and 1.1 Basics 1 July 5th, 2007 07:06 AM
displaying images in jsp using struts vijayalexander JSP Basics 0 November 6th, 2006 09:46 AM
Displaying Images From Database Metalore BOOK: Beginning ASP.NET 2.0 and Databases 1 November 1st, 2006 11:45 AM
strange problem with displaying LOB images in JSP BuryBear Pro JSP 1 April 23rd, 2006 03:48 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.