Unable to store the image into database
Hello,
I have created below program and program is throwing FileNotFound exception when I pressed the submit button. The problem is coming due to JSP page is not able to find complete path of image. I have debug the JSP program and found that HTML form pass only image name without path that's why problem is coming. Can anyone resolve this problem.
################## SQL Query ######################################
CREATE TABLE IMAGEMAIN(ID INTEGER,IMAGE BLOB) ;
################## HTML Form ######################
<form name="frm" method="post" action="index.jsp">
<input type="text" name="hint">
<input type="file" name="user_file">
<input type="submit">
################### JSP PAGE ########################
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Connection loaded");
Connection con = DriverManager.getConnection("jdbc:odbc:project","image","image");
System.out.println("Connection created");
String ll=request.getParameter("user_file");
String lo=request.getParameter("hint");
File imgfile = new File(ll);
FileInputStream fin = new FileInputStream(imgfile);
PreparedStatement pre = con.prepareStatement("insert into IMAGEMAIN (id,image) values(?,?)");
pre.setString(1,lo);
pre.setBinaryStream(2,fin,(int)imgfile.length());
pre.executeUpdate();
pre.close();
}
catch(Exception E)
{
out.println("the eror is "+ E);
}
View Answers
August 20, 2013 at 2:44 PM
Ads
Related Tutorials/Questions & Answers:
Unable to store the image into database
Unable to
store the
image into database Hello,
I have created below...);
}
Hi,
Please check the thread How to Insert
image into
database... of
image. I have debug the JSP program and found that HTML form pass only
image
How to store image into database
How to
store image into database Hi, all I want to
store image into
database using Java. Can anyone help me that how can i
store image into
database using Java.
Thanks in advance.
hi friend,
To
store image
Advertisements
How to store an image in database
How to
store an
image in database Hi...........
How to
store an
image in postgresql using a query. I mean tell me the way to
store an
image using datatype.
I am using the datatype bytea but tell me how to insert the
image
store and retrive image from the database
store and retrive
image from the database please provide me... 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
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 to store image upload path to mssql database
how to
store image upload path to mssql database hi there!!,
i need help in storing the
image upload path into the
database. basically i just use file select to upload the
image from jsp to
database. however when i click submit
how to store image upload path to mssql database
how to
store image upload path to mssql database hi there!!,
i need help in storing the
image upload path into the
database. basically i just use file select to upload the
image from jsp to
database. however when i click submit
how to store image upload path to mssql database
how to
store image upload path to mssql database hi there!!,
i need help in storing the
image upload path into the
database. basically i just use file select to upload the
image from jsp to
database. however when i click submit
how to store image upload path to mssql database
how to
store image upload path to mssql database hi there!!,
i need help in storing the
image upload path into the
database. basically i just use file select to upload the
image from jsp to
database. however when i click submit
unable to connect database in java
unable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect...
i was using this code....
try
{
Driver d=(Driver)Class.forName
unable to connect database in java
unable to connect
database in java Hello Everyone! i was trying to connect
database with my application by using java but i am
unable to connect...
i was using this code.
try
{
Driver d=(Driver)Class.forName
unable to insert data into database
unable to insert data into
database hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into
database based
unable to insert data into database
unable to insert data into
database hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into
database based
unable to insert data into database
unable to insert data into
database hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into
database based
unable to insert data into database
unable to insert data into
database hello.i have a problem in inserting data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting data into
database based
image in database
image in database how to set
image in
database and retrieve it using servlet(java)in msaccess
image store and get it back
image store and get it back
store the
image in the oracle using blob...
store the
image in table but at time of reading it back it never shows me the
image
and how to convert the
image file into binary format.... so that i can
store
How To Store Image Into MySQL Using Java
how to
store an
image into the
database
using Java and MySQL.
This example explains you about all the steps that how to
store image into
MySQL
database. To
store an
image into
database there are four data types
tinyblob, blob
image store in oracle using jswing
image store in oracle using jswing hello ,ihave searched the
image store in oracle using jswing but i did not find the code please help me
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
unable to get datas from oracle database
unable to get datas from oracle database Dear Sir,
I am again struck in my project..
i want to display data from oracle
database but i get...
org.apache.jasper.JasperException:
Unable to compile class for JSP:
An error occurred
image retrive into DataBase - JDBC
the
image into
DataBase.
Thanks & Regards,
VijayaBabu.M Hi,
Retrieving
image from
database is easy task. JDBC provides all the necessary API and function to retrieve the
image from
database. You retrieve
image from
database