呵呵,有这事?? 第一次遇到,
能详细描述一下你的 环境设置吗??什么版本的 MySQL??

解决方案 »

  1.   

    我的环境应该和大家差不多
    mysql版本:4.0.13
    java version 1.4.1附上unloadimage.jsp主要内容:
    <%@ page contentType="text/html;charset=gbK"%> 
    <%@ page import="java.sql.*" %>
    <%@ page import="java.util.*"%>
    <%@ page import="java.text.*"%>
    <%@ page import="java.io.*"%>
    <html> 
    <body> 
    <%
    Class.forName("com.mysql.jdbc.Driver");
    Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/genedb");
    Statement stmt=con.createStatement(); String filename=request.getParameter("image");ResultSet r = null;
            File file = new File(filename);
            int i =(int)file.length();
            byte[] l_buf = new byte[i];
      

  2.   

    接上面      try{
                FileInputStream fis = new FileInputStream(file);
                String sql="insert into tbl_person(photo) values(?)";
                PreparedStatement ps=con.prepareStatement(sql);      fis.read(l_buf);
                ps.setBytes(1,l_buf);
                ps.executeUpdate();
                ps.close();
                fis.close();        }
              catch(Exception e)
            {
                e.printStackTrace();
            }%>这个jsp代码比用ps.setBinaryStream方法要多一些,不过遇到的情况都一样
      

  3.   

    你可以看看这篇文章
    http://www.csdn.net/develop/article/19/10398.shtm