• 您的位置我爱Aspx >> VC.Net >> 如何通过struts以oci协议将文件上传到oracle数据库的blob字段
  • 如何通过struts以oci协议将文件上传到oracle数据库的blob字段

  • 作者:aspxer  来源:internet  日期:2007-5-21 23:49:26  关键字:数据库,数据
  • PreparedStatement ps = null ;

    String union_Id = "" ;

    String union_Version = "" ;

    union_Id = theForm.getUnion_Id() ;

    union_Version = theForm.getUnion_Version() ;

    是数据库表中的字段名,由于表中有多个blob字段,所以用变量来表示其名称

    String actionpart = theForm.getActionpart() ;

    System.out.println("actionpart is:"+actionpart) ;

    得数据库连接,dbPool的源代码附在后面

    dbPool dbp = new dbPool();

    conn = dbp.getConnection() ;

    ResultSet BlobDetails = null;

    Statement stmt = null;

    try {

    InputStream stream = null;

    FileInputStream fstream = null;

    stream = file.getInputStream();

    System.out.println("------------uploadFileSize is : "+stream.available() +"------------") ;

    conn.setAutoCommit(false);

    stmt = conn.createStatement();

    用empty_blob()来初始化该字段

    sql = " update regunion set " + actionpart + " = empty_blob() where union_id= " + union_Id +" and union_Version = "+ union_Version;

    我对这篇文章有话说?
  • 广告位招租,广告代号:content_468_15
  • 上一篇:mfc版本及其对应vc版本一览表
    下一篇:Win32学习笔记 第二章