应该是你数据库设计时的问题
注意字段piece的长度设置是否符合系统要求,记录要求

解决方案 »

  1.   

    我建的表:creat table test (id int,image blob);
     后来我又用了oracle jdbc 驱动,出错信息:
    java.sql.SQLException: ORA-01461: 仅可以为插入 LONG 列的 LONG 值赋值两天了,头都晕了,请高人指点。
      

  2.   

    必须使用oracle的jdbc驱动。
    blob字段不能直接使用insert语句插入。
    必须使用oracle的dbms_lob包插入空定位府empty_blob()。
    使用select....from....for update语句
    最后用流将图片写入。
      

  3.   

    只用jsp可以搞定吗?
    有没有更新的具体代码例子,我找了一个
    if (rs.next())
    {
    oracle.sql.BLOB blob = ((oracle.jdbc.OracleResultSet)rs).getBLOB("image");
              OutputStream outStream = blob.getBinaryOutputStream();
              fin.read(buffer);
              outStream.write(buffer);
              outStream.flush();
              stmt.execute("commit");
              outStream.close();
              
    }
    程序报错:
    org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Ref getRef(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Ref getRef(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Clob getClob(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Clob getClob(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Array getArray(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Array getArray(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Blob getBlob(int) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:0: The method oracle.jdbc2.Blob getBlob(java.lang.String) declared in interface oracle.jdbc.OracleResultSet cannot override the method of the same signature declared in interface java.sql.ResultSet.  They must have the same return type.
    import javax.servlet.*;
    ^
    D:\applications\tomcat\work\localhost_8080\_0002forcl_00031_0002ejsporcl1_jsp_16.java:100: Invalid cast from java.sql.ResultSet to oracle.jdbc.OracleResultSet.
                    oracle.sql.BLOB blob = ((oracle.jdbc.OracleResultSet)rs).getBLOB("image");
                                            ^
    9 errors, 1 warning是不是要用到servlet呢?我现在只会用jsp,谁能分析一下
      

  4.   

    在图片的字段中先要插入empty_blob(),然后先INSERT其他字段,在UPDATE图片的字段