当前位置: 技术问答>java相关
jsp向oracle数据库插入图片出错!急!为什么?
来源: 互联网 发布时间:2015-06-27
本文导语: Oracle数据库字段: id (NUMBER),content(VARCHAR2),img(BLOB) 以下是我的image.jsp代码: 执行后: 500 Servlet Exception java.sql.SQLException: ORA-01461: 仅可以为插入 LONG 列的 LONG 值赋值 at oracle.jdbc.dbaccess.DBError.throwSqlExce...
Oracle数据库字段:
id (NUMBER),content(VARCHAR2),img(BLOB)
以下是我的image.jsp代码:
执行后:
500 Servlet Exception
java.sql.SQLException: ORA-01461: 仅可以为插入 LONG 列的 LONG 值赋值
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at _img._insertnews__jsp._jspService(/img/insertNews.jsp:51)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:132)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:217)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:159)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Unknown Source)
id (NUMBER),content(VARCHAR2),img(BLOB)
以下是我的image.jsp代码:
执行后:
500 Servlet Exception
java.sql.SQLException: ORA-01461: 仅可以为插入 LONG 列的 LONG 值赋值
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
at _img._insertnews__jsp._jspService(/img/insertNews.jsp:51)
at com.caucho.jsp.JavaPage.service(JavaPage.java:74)
at com.caucho.jsp.Page.subservice(Page.java:485)
at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:181)
at com.caucho.server.http.Invocation.service(Invocation.java:291)
at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:132)
at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:217)
at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:159)
at com.caucho.server.TcpConnection.run(TcpConnection.java:136)
at java.lang.Thread.run(Unknown Source)
|
首先,你的代码好乱啊。^_^
其次,不要将图片放到数据库里。
给个路径就可以了。
其次,不要将图片放到数据库里。
给个路径就可以了。