how insert multiple images in mysql database with use of struts 1.3.8 or java method, with single bean,or using array
i am using netbeans 7.0 ,with struts 1.3.8 and i want to insert multiple images in mysql database ,with use of struts 1.3.8 ,or with the help of Array methods ,like google multiple attachment method with single bean .please advise me to solve it....Thanks..Arvind Sahu
View Answers
April 28, 2012 at 10:27 AM
import java.io.*;
import java.sql.*;
class InsertImages{
public static void main(String[] args)
{
try{
InputStream sImage;
PreparedStatement pre=null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
String imagename[]={"c:/rose1.jpg","c:/rose2.jpg","c:/rose3.jpg","c:/rose4.jpg"};
File imgfile[] = new File[4];
for(int i=0;i<imgfile.length;i++){
imgfile[i]=new File(imagename[i]);
FileInputStream fin = new FileInputStream(imgfile[i]);
pre = con.prepareStatement("insert into myfile( file_name, file_data) values ( ?, ?)");
pre.setString(1,imgfile[i].getName());
pre.setBinaryStream(2,fin,(int)imgfile[i].length());
pre.executeUpdate();
}
System.out.println("Inserting Successfully!");
pre.close();
con.close();
}
catch(Exception ex){
System.out.println("error :"+ex);
}
}
}
Ads
Related Tutorials/Questions & Answers:
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
Advertisements
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
How to upload multiple images in java(struts) using jsp?
How to upload
multiple images in
java(
struts)
using jsp? I have jsp... to upload the
multiple images in
struts
Total
images storing folder in project
using this jsp,but i want to CollegeAction class and CollegeForm class
how to do
database connection by using java bean
database connection by
using java bean i need a code for
bean class to connect to
mysql database.
subsequently to
use dis
bean class whereever i need 2 connect 2
database
how to scroll multiple images using on Click in Android
how to scroll
multiple images using on Click in Android I am new... there is requirement like
multiple image scrolling dynamically. But unfortunately i am unable to scroll
multiple images. But i am able to scroll
single image.
plz let me know
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse
how to use a single web page multiple functionaliteies
how to
use a
single web page
multiple functionaliteies i have a web page in that according to user role functionality should be varies/changes but page should be common for every user & functionality..my moto is to reduse