Home Answers Viewqa Swing-AWT How to retrive an inmage from database and displaying it in imgae box

 
 


neelam
How to retrive an inmage from database and displaying it in imgae box
1 Answer(s)      3 years and 6 months ago
Posted in : Swing AWT

View Answers

November 26, 2009 at 11:15 AM


Hi Friend,

Try the following code:

import java.sql.*;
import java.awt.*;
import javax.swing.*;

public class RetrieveImage{
public static void main(String argv[]){
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root";);
Statement stmt = con.createStatement();
ResultSet rs =stmt.executeQuery("select image from image where image_id='1'");
byte[] bytes=null;
if(rs.next()) {
bytes=rs.getBytes(1);
}
rs.close();
stmt.close();
con.close();
if(bytes!=null){
JFrame f = new JFrame();
f.setTitle("Display Image From database");
Image image = f.getToolkit().createImage(bytes);
f.getContentPane().add(new Pane(image));
f.setSize(300,100);
f.setVisible(true);
}
}
catch( Exception e ){}

}
}
class Pane extends JDesktopPane {
private Image image;
public Pane(Image image) {
this.image = image;
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
g.drawImage(image, 0, 0, this);
}
}

Thanks









Related Pages:
How to retrive an inmage from database and displaying it in imgae box - Swing AWT
How to retrive an inmage from database and displaying it in imgae box ...? I want to retrive an image from database and to display it in a small imagebox...(); f.setTitle("Display Image From database"); Image image = f.getToolkit
To retrive data from database - Struts
To retrive data from database  How to get values ,when i select a select box in jsp and has to get values in textbox automatically from database? eg... come to jsp page automatically from database
retrive data from database?
retrive data from database?  hellow i have a database sheet name... from db1 and enter value in text box according there name,rollno and save..... now i want retrive sn,roll no and name and textbox like
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
store and retrive image from the database
to store and retreive images from sql database using sql commands -how to store and retreive images from sql database using asp.net/c# thanks in advance...store and retrive image from the database  please provide me
how can retrive value from combo box in servlet?
how can retrive value from combo box in servlet?  i have a jsp page with combobox. And i want to get value from combox to servlet
image retrive into DataBase - JDBC
shows you how to retrieve image from database using a servlet and then show...image retrive into DataBase  Dear Deepak Sir, How to retrive..., Retrieving image from database is easy task. JDBC provides all the necessary API
jsp code for a drop down box to retrive value from database
jsp code for a drop down box to retrive value from database  my project needs to get the value from database in to the drop down box..... pls give me...=con.createStatement(); ResultSet rs=st.executeQuery("select * from login
store & retrive the image from oracle database
store & retrive the image from oracle database  how can i store the image path in tha database & fetch that image from oracle database
retrive data from database
retrive data from database   hi.. i made a application form. it's have attribute s.no,name,roll no and i enter a few records. now i want to view all record not in database access sheet i want to view it at any another
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field... record based on username and password. I dont know how to retrive in php with mysql
store and retrive image from database - JDBC
store and retrive image from database  how to store and retrive an image in database using java?  Hi friend, Code for store image...()); } } } For retrieve image from database visit to : http
retrive image from database using jsp without stream
retrive image from database using jsp without stream  How to retrive image from database using jsp without stream like (inputStream
how to retrive data grom database in jsp pages.
how to retrive data grom database in jsp pages.  sir, i have problem to retrieve data from table of the database on the html web pages , so would... immediately. i want sample code of jsp to retrieving data from table of database to html
displaying data
displaying data   how to display data from database on jsp using struts2
retrive mails - Java Beginners
retrive mails   hi how to retrive mails using mysql in java not using pop3 or imap directly from database i am using dbfile system in james server.header should be store in database and message in file system thanks bala
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  when am using mysqlfetcharray() that display the following error. the code look..._db("samp", $con); $Name=$_POST['unames']; $data=mysql_query("SELECT * FROM tbl
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from ms sql 2000 database into an html form text box and text area, using java..."); out.println("Display Data from Database"); out.println(""); out.println
jfreechart displaying chart from access database
jfreechart displaying chart from access database  I have these 2 codes. array.java----in which i retrieve the values from the database . import... javax.servlet.http.HttpServletResponse; /** * * @author AARUSHI */ class database { int roll; String
Displaying file from database
Displaying file from database  I have list of files in my database. I... that corresponding file from database. I have list of file id related to search. I want... * from file"; ResultSet rs = stmt.executeQuery(strQuery); while(rs.next
GWT -- retrive the data from Database
GWT -- retrive the data from Database  the user can create an event. In the create page, we have three buttons. Save as draft, preview and save... button, you have to create a dynamic jsp which should read the contents from
how to retrive
how to retrive  this my servlet page.. @Override protected void doGet(HttpServletRequest request, HttpServletResponse response... ArrayList(); String query = "select * from PRODUCT_LIST"; smp
displaying image
displaying image  how to upload image and retrieve it form database...="box"> <tr> <td width="246"> <input type="hidden" name="MAX_FILE...="box" id="upload" value=" Upload "></td> </tr> </table> <
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column... * from names"); echo "<p>Select a Name: n"; echo "<Select Name="ID">
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
how to import values from database to the drop down box
how to import values from database to the drop down box   hi iam... employee page i kept a drop down box for employee Ids i want all employee IDs will display in the drop down box please help me with the code
how to retrive other details with an image - Swing AWT
how to retrive other details with an image  hello I m trying to retrive an image as well as some other values from database.. but only image... time from database? button2.addActionListener(new ActionListener
insert and retrive image from sql server database in jsp
insert and retrive image from sql server database in jsp  what is the code to insert and retrive an image from sql server database in jsp
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... combo box which will then load the next combo box values, now i know how... a search on the database for the values I want, but then how do I pass that back
retrive record from the text field and insert into to database
retrive record from the text field and insert into to database  the following code is inserting values in the my sql database but i want to insert the data into oracle database , i want what changes i have to make
retrive data from database using jsp in struts?
retrive data from database using jsp in struts?   *search.jsp* <%@taglib uri="http://struts.apache.org/tags-html" prefix="html"%> <... searchProduct(SearchDTO sdto) { String query="select * from product
retrive values - JSP-Servlet
retrive values  how to get multiple values from html to jsp
Loading combo box from oracle
Loading combo box from oracle  how can i load values into a combobox from oracle database when a value is selected in another combo box
jsp retrive image - JSP-Interview Questions
jsp retrive image  How to Display Images in JSP retrieved from MYSQL database? plz help me..  Hi Friend, Please visit the following link: http://www.roseindia.net/jsp/retrieve-image.shtml Thanks
How to retrive database information using servlet and disply in table format in browser
How to retrive database information using servlet and disply in table format in browser  Hi, any one send code how to retrive the data base information in table format in web browser
how to display or retrive an image in jsp whose path is stored in oracle database
how to display or retrive an image in jsp whose path is stored in oracle database  how to display or retrive an image in jsp whose path is stored in oracle database and the image is stored in my pictures folder
unable to retrive the data from mysql using servlet using jdbc driver
unable to retrive the data from mysql using servlet using jdbc driver ... to the database"); stmt = con.createStatement(); rs = stmt.executeQuery("SELECT * FROM login where username="+username+" and password
how to insert data into database using jsp & retrive
how to insert data into database using jsp & retrive  Hello, I have created 1 html page which contain username, password & submit button. in my oracle10G database already contain table name admin which has name, password
By dropdownlist retrive data from database and show in textbox in jsp.
By dropdownlist retrive data from database and show in textbox in jsp.  Hello Sir, I am doing project in jsp.I have to retrive data from database, when I select value from dropdownlist, and that data I want to show in textbox
retrive data from oracle to jsp
retrive data from oracle to jsp  i am a beginer in jsp so please help...(); psmt= conn.prepareStatement("select * from CR_EMPLOYEE_DETAILS...; } } in SearchProjDAO i have to call servlet also how can i do this i have
retrive values - JSP-Servlet
retrive values  how to retrive multiple values from html to jsp  Hi Friend, Try the following code: 1)calljsp.html: Enter Name: Enter Address: Gender:MF Qualification: Btech MBA MCA MSC
Data displaying with limited records in jsp
Data displaying with limited records in jsp  How to display table with limited 10 records , after clicking next button another 10 records from database upto last record please help me
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page should display username, emailid, telephone in addition to tthe tagline however... sql = "select billid, customerid, billdate, status from customerbills where
image displaying from database with some other information
image displaying from database with some other information  hi, in the following section of code when i am not displaying the image it is working... only a cross mark is shows. same code runs if i am not retriveing any data from
how to insert list box in java script dynamically and elements retrieving from database like oracle
how to insert list box in java script dynamically and elements retrieving from database like oracle  Hi, how to dynamically increase size of list box in javascript when elements retrieving from database.. That is whenever I
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
url parameter using retrive data from database in jsp
url parameter using retrive data from database in jsp   the user can create an event. In the create page, we have three buttons. Save as draft... the contents from the db based on the event id. But this jsp url should be a public

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.