Results 1 to 4 of 4
- 11-29-2009, 06:29 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 6
- Rep Power
- 0
How to display Images from MS access using JSP
I tried and succeeded in pulling out the info from the ms access database tables. But I am not able to pull out the images. They are in the text form.
Is there any way to overcome this
this is my code:
Java Code:<html> <body> <%@ page import="java.sql.*,java.awt.Image" %> <% Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); Connection conn=null; conn = DriverManager.getConnection("jdbc:odbc:simpledb", "", ""); out.println ("Database Connected."); Statement s = conn.createStatement(); ResultSet r = s.executeQuery( "SELECT * " + "FROM bookprice"); while(r.next()) { out.println( r.getString("title") + " " + r.getString("price")+r.getString("Image")); } %> </body> </html>
- 11-30-2009, 08:27 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
I very much doubt (but admit I could be wrong) that you can store images in a text field. Do you mean you've stored the URL of the image there?
- 11-30-2009, 09:08 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 6
- Rep Power
- 0
yeah, that's my problem. It is not possible to store image in text. I need to replace r.getString("Image"); with something appropriate like r.getImage/getBlob("Image"); but it is of no use.......I was wondering if anybody knows how to store and retrieve OLE Image from MS access
- 11-30-2009, 09:28 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
You want to use the appropriate datatype, which would be Ole Object (looking at some access documentation). Then, presumably, use setBinaryStream to put it into the db, and getBinaryStream to get it out. I prefer to use streams, before anyone mentions get and setBlob.
Now, I have no idea if Access will work with this, but the "proper" dbs do.
Similar Threads
-
Default Access (package access) confusion
By gauravrajbehl in forum New To JavaReplies: 1Last Post: 11-18-2009, 10:48 AM -
display images
By prof.deedee in forum AWT / SwingReplies: 10Last Post: 11-12-2009, 09:08 PM -
Dynamic display of images
By gixerino in forum NetBeansReplies: 7Last Post: 01-15-2009, 02:55 PM -
How to display a list of items and on click display subitems?
By mandyj in forum New To JavaReplies: 8Last Post: 12-29-2008, 07:12 AM -
display images in a Web Application based on java/jsp
By mnsse in forum Advanced JavaReplies: 0Last Post: 03-25-2008, 12:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks