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);
}
%>