How to retrieve image from database
hi........
How to retrieve image from database when it is stored.
I have stored image in postgresql and want to retrieve in java form.
Can u tel me hw to do?
I am trying n able to do also but it retrieves as a string and not complete image can u tel me the conversion 4 n image.?
View Answers
September 26, 2011 at 3:44 PM
import java.sql.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class RetrieveImage{
public static void main(String[] args)throws Exception{
JFrame f=new JFrame();
f.setLayout(null);
JLabel lab1=new JLabel();
JLabel lab2=new JLabel("Name");
JTextField text1=new JTextField(20);
JLabel lab3=new JLabel("Address");
JTextField text2=new JTextField(20);
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "satya", "satya" );
Statement st=conn.createStatement();
ResultSet rs=st.executeQuery("select * from test where id=1");
byte[] bytes = null;
if(rs.next()){
String name=rs.getString("name");
text1.setText(name);
String address=rs.getString("address");
text2.setText(address);
bytes = rs.getBytes("image");
Image image = f.getToolkit().createImage(bytes);
ImageIcon icon=new ImageIcon(image);
lab1.setIcon(icon);
}
lab1.setBounds(150,10,100,100);
lab2.setBounds(10,120,100,20);
text1.setBounds(150,120,100,20);
lab3.setBounds(10,150,100,20);
text2.setBounds(150,150,100,20);
f.add(lab1);
f.add(lab2);
f.add(text1);
f.add(lab3);
f.add(text2);
f.setVisible(true);
f.setSize(350,200);
}
}
For more information, Visit Here
September 28, 2013 at 9:57 PM
the following errors shown:
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Ads
Related Tutorials/Questions & Answers:
How to retrieve image from database
How to
retrieve image from database hi........
How to
retrieve image from database when it is stored.
I have stored
image in postgresql and want to
retrieve in java form.
Can u tel me hw to do?
I am trying n able to do also
How to retrieve image from database in Servlet?
How to
retrieve image from database in Servlet? Hi,
How to
retrieve image from database in Servlet?
Thanks
Hi,
Please check the tutorial
Retrieve image from database using Servlet.
Thanks
Advertisements
How to store and retrieve image from database in JSP?
How to store and
retrieve image from database in JSP? Hi,
In one... and
retrieve image from database in JSP?
Thanks
HI,
You can use... the
image. Check this example:
Retrieve image from database using Servlet.
Thanks
How to retrieve blob image from database in JSP?
How to
retrieve blob
image from database in JSP? Hello,
JSP is used... the blog
image from database.
How to
retrieve blob
image from database in JSP?
Hi,
Please check the tutorial
Retrieve image from database using
How to retrieve image from mysql database in JSP?
How to
retrieve image from mysql
database in JSP? Hi,
I need JSP same codes for learning to get
image which is stored in MySQL
Database.
How to
retrieve image from mysql
database in JSP?
Thanks
Hi,
You can write
How to retrieve and display image from database in Java?
How to
retrieve and display
image from database in Java? Hi,
I am....
Please check the it at
How to store and
retrieve image from database in JSP... on the web page. My application is in Java/JSP.
How to
retrieve and display
image
how to store and retrieve image from database
how to store and
retrieve image from database
how to store and
retrieve images into
database(oracle) and
how to retrive images
from database using jsp
Here is a jsp code that insert and
retrieve image from mysql
how we retrieve image from database
how we
retrieve image from database my code is:-
$search=$_POST...;lt;/table>";
mysql_close($con);
PHP
retrieve image from mysql
database:
<?php
mysql_connect("localhost","username","password
Retrieve image from mysql database through jsp
Retrieve image from mysql
database through
jsp... to
retrieve image from
mysql
database through jsp code. First create a
database...' of
database 'mahendra'.
Structure of table 'save_
image'
First create
database named
how to retrieve images from database to jsp?
how to
retrieve images
from database to jsp? Hi sir,i want to stores images along with the name and price with
database and
retrieve it on jsp.and...();
String strQuery = "select
image from data where id="+id;
ResultSet rs
How To Retrieve Image From From MySQL Using Java
How To
Retrieve Image From From MySQL Using Java
In this section we will discuss about
how to
retrieve image from the MySQL
using Java.
This example explains you about all the steps that
how to
retrieve image from MySQL
database
Retrieve image from database using Servlet
Retrieve image from database using Servlet
 ... that connects to the MySQL
database and retrieves the
image from the
table. After... applications that retrieves the
image from database. You can use
this type
retrieve from database........
retrieve from database........ <p>hi i am not able to
retrieve string
from database to a text box in web page my code is as follows:-</p>...("username");
re=stmt.executeQuery("select *
from userreg where username='"+username
Fetching image from database
Fetching
image from database I have uploaded
image path and
image name in
database so, now
how can i display that
image using JSP or HTML page... in
database is:E:\1003\54175\20110407121554
image name i have stored