MySQL Blob insert

I need to insert some .doc files to mySQL Table. so i am using mysql blob data type for this. My Question is now, is there any way to submit the documents to mysql database table with out writing that file to Directory in the WEBROOT.
[241 byte] By [Ajaxranda] at [2007-11-27 3:33:51]
# 1
Yes. Just catch the byte[] and put it right in the BLOB without writing it to local file.
BalusCa at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

I tried it with this coding and it gets executed in the local machine successfully. but the problem occurs when i tried to execute the app using another machine in my LAN.

Error is getting then like:

java.io.FileNotFoundException and E:\file_name.doc

JSP>>>>

<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*, java.io.*" errorPage="" %>

<%

String my_file = request.getParameter("my_file");

FileInputStream fis=new FileInputStream(my_file);

byte[] b= new byte[fis.available()];

fis.read(b);

try{

String drivername = "org.gjt.mm.mysql.Driver";

Class.forName(drivername).newInstance();

String path="jdbc:mysql://localhost/my_db?user=root&password=dba";

Connection con=DriverManager.getConnection(path);

PreparedStatement st=con.prepareStatement("insert into docs(d_content) values(?)");

st.setBytes(1,b);

int rows=st.executeUpdate();

if(rows > 0 )

{

out.println("Values inserted succesfully");

}

else

out.println("Insertion Failed,Please try Again");

}

catch(Exception e1)

{

out.println(e1);

}

%>

Ajaxranda at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
You want to upload files? This is certainly not the way .. You're passing the complete file path and name as a request parameter, not the file contents.In http://www.google.com/search?q=jsp+file+upload you can find lot of good solutions.
BalusCa at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
I tried lots of file uploading jsp scripts but failed.Could you please help me to solve the problem with the current coding.
Ajaxranda at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
If i am not passing file contents how is working for local machine.
Ajaxranda at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
> If i am not passing file contents how is working for> local machine.You're passing the path. The appserver is running at the *same* machine. Go figure ;)
BalusCa at 2007-7-12 8:36:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...