如何在oracle中更新存储的图像

时间:2015-06-24 17:02:27

标签: sql jsp oracle10g blob

我使用blob数据类型

的列成功保存了图像

我的桌子是 studentid varchar2 phoneno号码 图像blob

我的问题是我无法继续更新数据库 你能告诉我更新blob数据类型

图像的代码吗?
enter code here`



  <%@include file="connection.jsp" %>
  <%@page contentType="text/html" pageEncoding="UTF-8"%>
   <!DOCTYPE html>
  <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
 </head>
 <body>
    <form name="=f1" action="dbupdatedetails.jsp">

       <% 
    String dbeid = request.getParameter("eid");
    String dbimgname = request.getParameter("imgname");
    String dbphno = request.getParameter("phno");


         String path1="C:/Users/sangu/Documents/NetBeansProjects/mini/web/images/"+dbimgname;


    PreparedStatement ps=conn.prepareStatement("update  aaa  set PHONENO=?,IMAGE=? where STUDENTID='"+dbeid+"' ");

     ps.setString(1,dbeid);
     ps.setString(2,dbphno);


      File f=new File(path1);
          int s=(int)f.length();
          FileInputStream fis=new FileInputStream(f);
          ps.setBinaryStream(3,fis,s);
      int k = ps.executeUpdate();
      if(k!=0 )
       { %>
       <script language="javascript" type="text/javascript">
 alert("updated sucessfully");
</script>
   <%}   %>
    %>
    </form>
</body>

`

0 个答案:

没有答案